From d3ebcf89311d329c5dde98cebd1136e9cfcb8718 Mon Sep 17 00:00:00 2001 From: Sebastian Urchs Date: Tue, 17 Oct 2023 16:56:59 -0400 Subject: [PATCH] [FIX] column no longer styled if selectedTool is null --- components/category-toolgroup.vue | 7 +++++-- cypress/component/category-toolgroup.cy.js | 19 +++++++++++++++++++ 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/components/category-toolgroup.vue b/components/category-toolgroup.vue index 84e45af9..6d9fb1d3 100644 --- a/components/category-toolgroup.vue +++ b/components/category-toolgroup.vue @@ -104,7 +104,10 @@ this.alterColumnToToolMapping({columnName: row.column, toolIdentifier: this.selectedTool.identifier}); }, styleRow(p_row) { - if (this.columnToToolMap[p_row.column] === this.selectedTool.identifier) { + if ( + (this.columnToToolMap[p_row.column] !== null) && + (this.columnToToolMap[p_row.column] === this.selectedTool.identifier) + ) { return "selected-tool"; } else { return ""; @@ -119,4 +122,4 @@ background-color: red !important; } - \ No newline at end of file + diff --git a/cypress/component/category-toolgroup.cy.js b/cypress/component/category-toolgroup.cy.js index a2eccf29..a07a9ba0 100644 --- a/cypress/component/category-toolgroup.cy.js +++ b/cypress/component/category-toolgroup.cy.js @@ -99,6 +99,25 @@ describe("Tool Group component", () => { cy.get("[data-cy='assessment-column-table']").contains("column3"); }); + it("before a tool is selected, all columns are unstyled", () => { + store.state.columnToToolMap = { + column1: null, + column2: null, + column3: null + }; + + cy.mount(categoryToolGroup, { + mocks: { + + $store: store + } + }); + + cy.get("[data-cy='assessment-column-table']").find("tr:contains('column1')").should('not.have.class', 'selected-tool'); + cy.get("[data-cy='assessment-column-table']").find("tr:contains('column3')").should('not.have.class', 'selected-tool'); + + }); + it("gets assessment tool names from the store and shows them in a dropdown", () => { cy.mount(categoryToolGroup, { mocks: {