Skip to content

Commit

Permalink
Add columnToToolMap in the store
Browse files Browse the repository at this point in the history
  • Loading branch information
surchs committed Oct 17, 2023
1 parent 8113dd5 commit 410d9cb
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
10 changes: 5 additions & 5 deletions components/category-toolgroup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
...mapState([
"toolTerms",
"column2ToolMap"
"columnToToolMap"
]),
tableRows() {
return this.getColumnsForCategory('Assessment Tool').map(column => ({
Expand Down Expand Up @@ -101,14 +101,14 @@
return "";
},
mapColumnToTool(row) {
if (this.column2ToolMap[row.column] === this.selectedTool.identifier) {
this.column2ToolMap[row.column] = null;
if (this.columnToToolMap[row.column] === this.selectedTool.identifier) {
this.columnToToolMap[row.column] = null;
} else {
this.column2ToolMap[row.column] = this.selectedTool.identifier;
this.columnToToolMap[row.column] = this.selectedTool.identifier;
}
},
styleRow(p_row) {
if (this.column2ToolMap[p_row.column] === this.selectedTool.id) {
if (this.columnToToolMap[p_row.column] === this.selectedTool.id) {
return "selected-tool";
} else {
return "";
Expand Down
4 changes: 2 additions & 2 deletions cypress/component/category-toolgroup.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe("Tool Group component", () => {
column3: "Assessment Tool"
},

column2ToolMap: {
columnToToolMap: {
column1: 'cogatlas:MOCA',
column2: null,
column3: 'cogatlas:UPDRSIII'
Expand Down Expand Up @@ -127,7 +127,7 @@ describe("Tool Group component", () => {
});

it("when a tool is selected in the store, it appears in the tool table", () => {
store.state.toolTerms.spli[0]['selected'] = true;
store.state.toolTerms[0]['selected'] = true;
store.getters = makeGetters(store.state);
cy.mount(categoryToolGroup, {
mocks: {
Expand Down
4 changes: 3 additions & 1 deletion store/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,9 @@ export const state = () => ({
identifier: "cogAtlas:UPDRS",
selected: false
}
]
],

columnToToolMap: {}
});

export const getters = {
Expand Down

0 comments on commit 410d9cb

Please sign in to comment.