Skip to content

Commit

Permalink
Merge pull request #161 from nzzdev/release-5.0.4
Browse files Browse the repository at this point in the history
Release 5.0.4
  • Loading branch information
fgervasi committed Nov 22, 2021
2 parents 3ae5609 + 769bfba commit 1ba5882
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 7 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "q-table",
"version": "5.0.3",
"version": "5.0.4",
"description": "",
"main": "index.js",
"scripts": {
Expand Down
51 changes: 51 additions & 0 deletions resources/fixtures/data/one-column.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"title": "FIXTURE: simple one-column short table with numeric values",
"subtitle": "some subtitle here",
"data": {
"table": [
[
"Punkte"
],
[
"10000000"
],
[
"20000000"
],
[
"355547.5"
],
[
"-3500000"
]
],
"metaData": {
"cells": []
}
},
"options": {
"cardLayout": false,
"cardLayoutIfSmall": false,
"minibar": {
"invertColors": false,
"barColor": {
"positive": {
"className": "",
"colorCode": ""
},
"negative": {
"className": "",
"colorCode": ""
}
},
"selectedColumn": null
}
},
"notes": "Anmerkungen",
"sources": [
{
"link": {},
"text": "Bloomberg"
}
]
}
4 changes: 2 additions & 2 deletions routes/option-availability.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ module.exports = {
if (item.data.table.length !== 0) {
if (
!item.options.cardLayout &&
item.data.table[0].length >= 3 &&
item.data.table[0].length >= 2 &&
getNumericColumns(item.data.table).length >= 1
) {
isAvailable = true;
Expand Down Expand Up @@ -112,7 +112,7 @@ module.exports = {
if (item.data.table.length > 2) {
if (
!item.options.cardLayout &&
item.data.table[0].length >= 3 &&
item.data.table[0].length >= 2 &&
item.data.table.length >= 1
) {
isAvailable = true;
Expand Down
28 changes: 26 additions & 2 deletions test/e2e-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ lab.experiment("option availability endpoint", () => {
expect(response.result.available).to.be.equal(true);
});

it("returns false for option availability of minibar selectedColumn", async () => {
it("returns true for option availability of minibar selectedColumn", async () => {
const request = {
method: "POST",
url: "/option-availability/selectedColumnMinibar",
Expand All @@ -138,6 +138,18 @@ lab.experiment("option availability endpoint", () => {
},
};
const response = await server.inject(request);
expect(response.result.available).to.be.equal(true);
});

it("Minibar is not available from a certain number of columns", async () => {
const request = {
method: "POST",
url: "/option-availability/selectedColumnMinibar",
payload: {
item: require("../resources/fixtures/data/one-column.json"),
},
};
const response = await server.inject(request);
expect(response.result.available).to.be.equal(false);
});

Expand All @@ -153,7 +165,7 @@ lab.experiment("option availability endpoint", () => {
expect(response.result.available).to.be.equal(true);
});

it("returns false for option availability of colorColumn selectedColumn", async () => {
it("returns true for option availability of colorColumn selectedColumn", async () => {
const request = {
method: "POST",
url: "/option-availability/selectedColorColumn",
Expand All @@ -162,6 +174,18 @@ lab.experiment("option availability endpoint", () => {
},
};
const response = await server.inject(request);
expect(response.result.available).to.be.equal(true);
});

it("ColorColumn is not available from a certain number of columns", async () => {
const request = {
method: "POST",
url: "/option-availability/selectedColorColumn",
payload: {
item: require("../resources/fixtures/data/one-column.json"),
},
};
const response = await server.inject(request);
expect(response.result.available).to.be.equal(false);
});
});
Expand Down

0 comments on commit 1ba5882

Please sign in to comment.