Skip to content

Commit

Permalink
Added assessment column table
Browse files Browse the repository at this point in the history
and test
  • Loading branch information
rmanaem committed Oct 12, 2023
1 parent 1df0468 commit 0a37a10
Show file tree
Hide file tree
Showing 2 changed files with 112 additions and 0 deletions.
30 changes: 30 additions & 0 deletions components/category-toolgroup.vue
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>
82 changes: 82 additions & 0 deletions cypress/component/category-toolgroup.cy.js
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");
});

});

0 comments on commit 0a37a10

Please sign in to comment.