-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
and test
- Loading branch information
Showing
2 changed files
with
112 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<template> | ||
<b-table | ||
data-cy="assessment-column-table" | ||
outlined | ||
selectable | ||
head-variant="dark" | ||
:items="tableRows" | ||
select-mode="single" | ||
selected-variant="" | ||
thead-class="hidden" /> | ||
</template> | ||
|
||
<script> | ||
import { mapGetters } from 'vuex'; | ||
export default { | ||
computed: { | ||
...mapGetters([ | ||
'getColumnsForCategory' | ||
]), | ||
tableRows() { | ||
return this.getColumnsForCategory('Assessment Tool').map(column => ({ | ||
column: column | ||
})); | ||
} | ||
} | ||
}; | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
import categoryToolGroup from "~/components/category-toolgroup.vue"; | ||
import { getters } from "~/store"; | ||
|
||
let store; | ||
let state; | ||
|
||
describe("Tool Group component", () => { | ||
|
||
beforeEach(() => { | ||
state = { | ||
|
||
columnToCategoryMap: { | ||
column1: "Assessment Tool", | ||
column2: "Age", | ||
column3: "Assessment Tool" | ||
}, | ||
|
||
dataDictionary: { | ||
|
||
annotated: { | ||
|
||
column1: { missingValues: [] }, | ||
column2: { missingValues: [] }, | ||
column3: { missingValues: ["column3_value1", "column3_value2"] } | ||
} | ||
}, | ||
|
||
dataTable: [ | ||
|
||
{ column1: 1, column2: "column2_value1", column3: "column3_value1" }, | ||
{ column1: 2, column2: "column2_value2", column3: "column3_value2" }, | ||
{ column1: 1, column2: "column2_value3", column3: "column3_value3" }, | ||
{ column1: 3, column2: "column2_value2", column3: "column3_value4" } | ||
] | ||
}; | ||
store = { | ||
|
||
state: state, | ||
getters: { | ||
getColumnsForCategory: getters.getColumnsForCategory(state) | ||
} | ||
}; | ||
}); | ||
|
||
it("mounts", () => { | ||
cy.mount(categoryToolGroup, { | ||
mocks: { | ||
|
||
$store: store | ||
} | ||
}); | ||
|
||
}); | ||
|
||
it("has a table of columns about assessment tools on the right", () => { | ||
|
||
cy.mount(categoryToolGroup, { | ||
mocks: { | ||
|
||
$store: store | ||
} | ||
}); | ||
|
||
cy.get("[data-cy='assessment-column-table']").should("be.visible"); | ||
|
||
}); | ||
|
||
it("gets columns about assessment tools from the store and shows them to me", () => { | ||
|
||
cy.mount(categoryToolGroup, { | ||
mocks: { | ||
|
||
$store: store | ||
} | ||
|
||
}); | ||
|
||
cy.get("[data-cy='assessment-column-table']").contains("column1"); | ||
cy.get("[data-cy='assessment-column-table']").contains("column3"); | ||
}); | ||
|
||
}); |