@eox/itemfilter 0.8.1 → 0.8.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/eox-itemfilter.js +483 -461
- package/dist/eox-itemfilter.umd.cjs +58 -44
- package/package.json +1 -1
- package/test/state.cy.ts +73 -0
package/package.json
CHANGED
package/test/state.cy.ts
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import "../src/main";
|
|
2
|
+
import testItems from "./testItems.json";
|
|
3
|
+
|
|
4
|
+
describe("Item Filter Config", () => {
|
|
5
|
+
const state = {
|
|
6
|
+
agriculture: true,
|
|
7
|
+
health: true,
|
|
8
|
+
};
|
|
9
|
+
const selectedResultIndex = 1;
|
|
10
|
+
beforeEach(() => {
|
|
11
|
+
cy.mount(`<eox-itemfilter></eox-itemfilter>`)
|
|
12
|
+
.as("eox-itemfilter")
|
|
13
|
+
.then((eoxItemFilter: any) => {
|
|
14
|
+
eoxItemFilter[0].config = {
|
|
15
|
+
titleProperty: "title",
|
|
16
|
+
filterProperties: [
|
|
17
|
+
{
|
|
18
|
+
key: "themes",
|
|
19
|
+
type: "multiselect",
|
|
20
|
+
expanded: true,
|
|
21
|
+
state,
|
|
22
|
+
},
|
|
23
|
+
],
|
|
24
|
+
aggregateResults: "themes",
|
|
25
|
+
};
|
|
26
|
+
eoxItemFilter[0].apply(testItems);
|
|
27
|
+
eoxItemFilter[0].selectedResult = testItems[selectedResultIndex];
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it("should render the checkboxes as checked", () => {
|
|
32
|
+
cy.get("eox-itemfilter")
|
|
33
|
+
.shadow()
|
|
34
|
+
.within(() => {
|
|
35
|
+
cy.get("input[data-cy=multiselect-checkbox][checked]").should(
|
|
36
|
+
"have.length",
|
|
37
|
+
2
|
|
38
|
+
);
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
it("should only show the results of the pre-set filters", () => {
|
|
43
|
+
cy.get("eox-itemfilter")
|
|
44
|
+
.shadow()
|
|
45
|
+
.within(() => {
|
|
46
|
+
Object.keys(state).forEach((key) => {
|
|
47
|
+
cy.get(".details-results > summary > .title").should(
|
|
48
|
+
"contain.text",
|
|
49
|
+
key
|
|
50
|
+
);
|
|
51
|
+
cy.get(".details-results > summary > .title").should(
|
|
52
|
+
"contain.text",
|
|
53
|
+
key
|
|
54
|
+
);
|
|
55
|
+
});
|
|
56
|
+
cy.get(".details-results > summary > .title").should(
|
|
57
|
+
"have.length",
|
|
58
|
+
Object.keys(state).length
|
|
59
|
+
);
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
it("should render the pre-set result as checked", () => {
|
|
64
|
+
cy.get("eox-itemfilter")
|
|
65
|
+
.shadow()
|
|
66
|
+
.within(() => {
|
|
67
|
+
cy.get("input[data-cy=result-radio]")
|
|
68
|
+
.eq(selectedResultIndex)
|
|
69
|
+
.should("be.checked");
|
|
70
|
+
cy.get("input[data-cy=result-radio][checked]").should("have.length", 1);
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
});
|