From dd1ddfa8dcc928a9fbbb689219430dbbf197f3b9 Mon Sep 17 00:00:00 2001 From: Franco Gervasi Date: Thu, 18 Nov 2021 16:11:34 +0100 Subject: [PATCH 1/3] Activate color and minibars from two columns --- routes/option-availability.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/routes/option-availability.js b/routes/option-availability.js index 46bd0b23..6dbcd934 100644 --- a/routes/option-availability.js +++ b/routes/option-availability.js @@ -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; @@ -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; From b90c6ef1de59e121dad7ca12d87ea3b30a9e681b Mon Sep 17 00:00:00 2001 From: Franco Gervasi Date: Thu, 18 Nov 2021 16:13:48 +0100 Subject: [PATCH 2/3] Release v5.0.4 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 7376aca4..5e549e94 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "q-table", - "version": "5.0.3", + "version": "5.0.4", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "q-table", - "version": "5.0.3", + "version": "5.0.4", "license": "MIT", "dependencies": { "@hapi/boom": "^9.1.3", diff --git a/package.json b/package.json index c790dc7e..72bee37d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "q-table", - "version": "5.0.3", + "version": "5.0.4", "description": "", "main": "index.js", "scripts": { From 769bfbaeae7463eb27e80f662d368ee1a98ecb2e Mon Sep 17 00:00:00 2001 From: Franco Gervasi Date: Fri, 19 Nov 2021 07:20:11 +0100 Subject: [PATCH 3/3] Fix test and add new test --- resources/fixtures/data/one-column.json | 51 +++++++++++++++++++++++++ test/e2e-tests.js | 28 +++++++++++++- 2 files changed, 77 insertions(+), 2 deletions(-) create mode 100644 resources/fixtures/data/one-column.json diff --git a/resources/fixtures/data/one-column.json b/resources/fixtures/data/one-column.json new file mode 100644 index 00000000..6014fbf9 --- /dev/null +++ b/resources/fixtures/data/one-column.json @@ -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" + } + ] +} diff --git a/test/e2e-tests.js b/test/e2e-tests.js index 8afd0ec5..da6d30ed 100644 --- a/test/e2e-tests.js +++ b/test/e2e-tests.js @@ -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", @@ -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); }); @@ -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", @@ -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); }); });