@eox/itemfilter 1.1.2 → 1.3.0
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 +39 -20
- package/dist/eox-itemfilter.umd.cjs +110 -95
- package/package.json +1 -1
- package/test/cases/general/index.js +1 -0
- package/test/cases/general/validation.js +22 -0
- package/test/general.cy.js +10 -0
package/package.json
CHANGED
|
@@ -10,3 +10,4 @@ export { default as spatialFilterTest } from "./spatial-filter";
|
|
|
10
10
|
export { default as externalFilterTest } from "./external-filter";
|
|
11
11
|
export { default as nestedPropertyTest } from "./nested-property";
|
|
12
12
|
export { default as subtitleTest } from "./subtitle";
|
|
13
|
+
export { default as validationTest } from "./validation";
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tests the validation option of the text input.
|
|
3
|
+
*/
|
|
4
|
+
const validationTest = () => {
|
|
5
|
+
cy.get("eox-itemfilter")
|
|
6
|
+
.shadow()
|
|
7
|
+
.within(() => {
|
|
8
|
+
cy.get("[data-cy='text-filter']").then(($elList) => {
|
|
9
|
+
const el = $elList[0];
|
|
10
|
+
cy.get(".error-validation").should("not.have.text");
|
|
11
|
+
cy.get("[data-cy='search']").type("abcdefghijk");
|
|
12
|
+
cy.get(".error-validation").should(
|
|
13
|
+
"have.text",
|
|
14
|
+
el.filterObject.validation.message
|
|
15
|
+
);
|
|
16
|
+
cy.get("[data-cy='search']").clear();
|
|
17
|
+
cy.get(".error-validation").should("not.have.text");
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export default validationTest;
|
package/test/general.cy.js
CHANGED
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
externalFilterTest,
|
|
13
13
|
nestedPropertyTest,
|
|
14
14
|
subtitleTest,
|
|
15
|
+
validationTest,
|
|
15
16
|
} from "./cases/general/";
|
|
16
17
|
|
|
17
18
|
/**
|
|
@@ -36,6 +37,10 @@ describe("Item Filter Config", () => {
|
|
|
36
37
|
title: "Search",
|
|
37
38
|
type: "text",
|
|
38
39
|
expanded: true,
|
|
40
|
+
validation: {
|
|
41
|
+
pattern: ".{0,10}",
|
|
42
|
+
message: "Maximum 10 characters",
|
|
43
|
+
},
|
|
39
44
|
},
|
|
40
45
|
{ key: "themes", expanded: true },
|
|
41
46
|
],
|
|
@@ -97,4 +102,9 @@ describe("Item Filter Config", () => {
|
|
|
97
102
|
* Test case to check if subtitles are rendered correctly
|
|
98
103
|
*/
|
|
99
104
|
it("should render subtitles", () => subtitleTest());
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Test case to check if input validation is working
|
|
108
|
+
*/
|
|
109
|
+
it("should have working validation", () => validationTest());
|
|
100
110
|
});
|