@ui5/webcomponents-base 2.1.1 → 2.2.0-rc.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/CHANGELOG.md +18 -0
- package/cypress/specs/Accessor.cy.ts +83 -0
- package/cypress/specs/Boot.cy.ts +23 -0
- package/cypress/specs/ConfigurationChange.cy.ts +41 -0
- package/cypress/specs/ConfigurationScript.cy.ts +116 -0
- package/cypress/specs/ConfigurationURL.cy.ts +182 -0
- package/cypress/specs/CustomMount.cy.ts +34 -0
- package/cypress/specs/CustomTheme.cy.ts +36 -0
- package/cypress/specs/EventProvider.cy.ts +59 -0
- package/cypress/specs/SystemDOMElements.cy.ts +8 -0
- package/cypress/specs/Theming.cy.ts +74 -0
- package/cypress/specs/UI5ElementInvalidation.cy.ts +207 -0
- package/cypress/specs/UI5ElementLifecycle.cy.ts +82 -0
- package/cypress/specs/UI5ElementListenForChildPropChanges.cy.ts +62 -0
- package/cypress/specs/UI5ElementMetadataExt.cy.ts +42 -0
- package/cypress/specs/UI5ElementPropertyValidation.cy.ts +17 -0
- package/cypress/specs/UI5ElementPropsAndAttrs.cy.ts +113 -0
- package/cypress/specs/UI5ElementShadowDOM.cy.ts +30 -0
- package/cypress/specs/UI5ElementSlots.cy.ts +116 -0
- package/cypress/specs/WithComplexTemplate.cy.ts +32 -0
- package/cypress/tsconfig.json +20 -0
- package/cypress.config.js +3 -0
- package/dist/.tsbuildinfobuild +1 -0
- package/dist/InitialConfiguration.d.ts +7 -1
- package/dist/InitialConfiguration.js +20 -3
- package/dist/InitialConfiguration.js.map +1 -1
- package/dist/Location.d.ts +10 -0
- package/dist/Location.js +43 -0
- package/dist/Location.js.map +1 -0
- package/dist/Runtimes.js +11 -0
- package/dist/Runtimes.js.map +1 -1
- package/dist/UI5Element.js +19 -11
- package/dist/UI5Element.js.map +1 -1
- package/dist/config/AnimationMode.js +4 -0
- package/dist/config/AnimationMode.js.map +1 -1
- package/dist/config/CalendarType.js +5 -0
- package/dist/config/CalendarType.js.map +1 -1
- package/dist/config/ConfigurationReset.d.ts +4 -0
- package/dist/config/ConfigurationReset.js +11 -0
- package/dist/config/ConfigurationReset.js.map +1 -0
- package/dist/config/Fonts.js +4 -0
- package/dist/config/Fonts.js.map +1 -1
- package/dist/config/FormatSettings.js +4 -0
- package/dist/config/FormatSettings.js.map +1 -1
- package/dist/config/Language.js +6 -1
- package/dist/config/Language.js.map +1 -1
- package/dist/config/NoConflict.js +4 -0
- package/dist/config/NoConflict.js.map +1 -1
- package/dist/config/Theme.js +4 -0
- package/dist/config/Theme.js.map +1 -1
- package/dist/config/ThemeRoot.js +4 -0
- package/dist/config/ThemeRoot.js.map +1 -1
- package/dist/config/Timezone.js +4 -0
- package/dist/config/Timezone.js.map +1 -1
- package/dist/config/Tooltips.d.ts +19 -0
- package/dist/config/Tooltips.js +29 -0
- package/dist/config/Tooltips.js.map +1 -0
- package/dist/custom-elements-internal.json +48 -0
- package/dist/custom-elements.json +48 -0
- package/dist/decorators/query.d.ts +25 -0
- package/dist/decorators/query.js +32 -0
- package/dist/decorators/query.js.map +1 -0
- package/dist/decorators/queryAll.d.ts +27 -0
- package/dist/decorators/queryAll.js +34 -0
- package/dist/decorators/queryAll.js.map +1 -0
- package/dist/generated/VersionInfo.js +5 -5
- package/dist/generated/VersionInfo.js.map +1 -1
- package/dist/prod/InitialConfiguration.js +1 -1
- package/dist/prod/InitialConfiguration.js.map +3 -3
- package/dist/prod/Location.js +2 -0
- package/dist/prod/Location.js.map +7 -0
- package/dist/prod/Runtimes.js +1 -1
- package/dist/prod/Runtimes.js.map +3 -3
- package/dist/prod/UI5Element.js +1 -1
- package/dist/prod/UI5Element.js.map +2 -2
- package/dist/prod/config/AnimationMode.js +1 -1
- package/dist/prod/config/AnimationMode.js.map +3 -3
- package/dist/prod/config/CalendarType.js +1 -1
- package/dist/prod/config/CalendarType.js.map +3 -3
- package/dist/prod/config/ConfigurationReset.js +2 -0
- package/dist/prod/config/ConfigurationReset.js.map +7 -0
- package/dist/prod/config/Fonts.js +1 -1
- package/dist/prod/config/Fonts.js.map +3 -3
- package/dist/prod/config/FormatSettings.js +1 -1
- package/dist/prod/config/FormatSettings.js.map +3 -3
- package/dist/prod/config/Language.js +1 -1
- package/dist/prod/config/Language.js.map +3 -3
- package/dist/prod/config/NoConflict.js +1 -1
- package/dist/prod/config/NoConflict.js.map +3 -3
- package/dist/prod/config/Theme.js +1 -1
- package/dist/prod/config/Theme.js.map +3 -3
- package/dist/prod/config/ThemeRoot.js +1 -1
- package/dist/prod/config/ThemeRoot.js.map +3 -3
- package/dist/prod/config/Timezone.js +1 -1
- package/dist/prod/config/Timezone.js.map +3 -3
- package/dist/prod/config/Tooltips.js +2 -0
- package/dist/prod/config/Tooltips.js.map +7 -0
- package/dist/prod/decorators/query.js +2 -0
- package/dist/prod/decorators/query.js.map +7 -0
- package/dist/prod/decorators/queryAll.js +2 -0
- package/dist/prod/decorators/queryAll.js.map +7 -0
- package/dist/prod/generated/VersionInfo.js +1 -1
- package/dist/prod/generated/VersionInfo.js.map +2 -2
- package/dist/prod/validateThemeRoot.js +1 -1
- package/dist/prod/validateThemeRoot.js.map +3 -3
- package/dist/validateThemeRoot.js +3 -2
- package/dist/validateThemeRoot.js.map +1 -1
- package/package-scripts.cjs +5 -3
- package/package.json +4 -3
- package/tsconfig.json +19 -19
- package/config/wdio.conf.cjs +0 -392
- package/dist/.tsbuildinfo +0 -1
- package/dist/generated/templates/elements/WithComplexTemplateTemplate.lit.d.ts +0 -4
- package/dist/generated/templates/elements/WithComplexTemplateTemplate.lit.js +0 -9
- package/dist/generated/templates/elements/WithComplexTemplateTemplate.lit.js.map +0 -1
- package/dist/prod/generated/templates/elements/WithComplexTemplateTemplate.lit.js +0 -2
- package/dist/prod/generated/templates/elements/WithComplexTemplateTemplate.lit.js.map +0 -7
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
import type UI5Element from "../../src/UI5Element.js";
|
|
2
|
+
import "../../test/test-elements/Generic.js";
|
|
3
|
+
|
|
4
|
+
describe("Invalidation works", () => {
|
|
5
|
+
it("Tests that changing a property invalidates", () => {
|
|
6
|
+
cy.mount(`<ui5-test-generic></ui5-test-generic>`);
|
|
7
|
+
|
|
8
|
+
cy.get("[ui5-test-generic]")
|
|
9
|
+
.as("testGeneric")
|
|
10
|
+
.then(el => {
|
|
11
|
+
cy.spy<UI5Element>((el.get(0) as UI5Element), "onInvalidation").as("invalidations");
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
cy.get("@testGeneric")
|
|
15
|
+
.invoke("prop", "strProp", "new value");
|
|
16
|
+
|
|
17
|
+
cy.get("@testGeneric")
|
|
18
|
+
.invoke("prop", "boolProp", true);
|
|
19
|
+
|
|
20
|
+
cy.get("@invalidations")
|
|
21
|
+
.should("have.been.calledTwice");
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it("Tests that setting a property to the same value does not invalidate", () => {
|
|
25
|
+
cy.mount(`<ui5-test-generic></ui5-test-generic>`);
|
|
26
|
+
|
|
27
|
+
const text = "new value";
|
|
28
|
+
|
|
29
|
+
cy.get("[ui5-test-generic]")
|
|
30
|
+
.as("testGeneric")
|
|
31
|
+
.invoke("prop", "strProp", text)
|
|
32
|
+
.then(el => {
|
|
33
|
+
cy.spy<UI5Element>((el.get(0) as UI5Element), "onInvalidation").as("invalidations");
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
cy.get("@testGeneric")
|
|
37
|
+
.invoke("prop", "strProp", text);
|
|
38
|
+
|
|
39
|
+
cy.get("@invalidations")
|
|
40
|
+
.should("have.not.been.called");
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
it("Tests that setting a property of type Object always invalidates", () => {
|
|
44
|
+
cy.mount(`<ui5-test-generic></ui5-test-generic>`);
|
|
45
|
+
|
|
46
|
+
const obj = {};
|
|
47
|
+
const otherObj = {};
|
|
48
|
+
|
|
49
|
+
cy.get("[ui5-test-generic]")
|
|
50
|
+
.as("testGeneric")
|
|
51
|
+
.invoke("prop", "objectProp", obj)
|
|
52
|
+
.then(el => {
|
|
53
|
+
cy.spy<UI5Element>((el.get(0) as UI5Element), "onInvalidation").as("invalidations");
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
cy.get("@testGeneric")
|
|
57
|
+
.invoke("prop", "objectProp", otherObj);
|
|
58
|
+
|
|
59
|
+
cy.get("@invalidations")
|
|
60
|
+
.should("have.been.calledOnce");
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
it("Tests that setting an array property always invalidates", () => {
|
|
64
|
+
cy.mount(`<ui5-test-generic></ui5-test-generic>`);
|
|
65
|
+
|
|
66
|
+
const arr: Array<string> = [];
|
|
67
|
+
const otherArr: Array<string> = [];
|
|
68
|
+
|
|
69
|
+
cy.get("[ui5-test-generic]")
|
|
70
|
+
.as("testGeneric")
|
|
71
|
+
.invoke("prop", "multiProp", arr)
|
|
72
|
+
.then(el => {
|
|
73
|
+
cy.spy<UI5Element>((el.get(0) as UI5Element), "onInvalidation").as("invalidations");
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
cy.get("@testGeneric")
|
|
77
|
+
.invoke("prop", "multiProp", otherArr);
|
|
78
|
+
|
|
79
|
+
cy.get("@invalidations")
|
|
80
|
+
.should("have.been.calledOnce");
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
it("Tests that adding a child invalidates", () => {
|
|
84
|
+
cy.mount(`<ui5-test-generic></ui5-test-generic>`);
|
|
85
|
+
|
|
86
|
+
cy.get("[ui5-test-generic]")
|
|
87
|
+
.as("testGeneric")
|
|
88
|
+
.then(el => {
|
|
89
|
+
cy.spy<UI5Element>((el.get(0) as UI5Element), "onInvalidation").as("invalidations");
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
cy.get("@testGeneric")
|
|
93
|
+
.then($testGeneric => {
|
|
94
|
+
const div = document.createElement("div");
|
|
95
|
+
$testGeneric.append(div);
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
cy.get("@invalidations")
|
|
99
|
+
.should("have.been.called");
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
it("Tests that removing a child invalidates", () => {
|
|
103
|
+
cy.mount(`<ui5-test-generic></ui5-test-generic>`);
|
|
104
|
+
|
|
105
|
+
const div = document.createElement("div");
|
|
106
|
+
|
|
107
|
+
cy.get("[ui5-test-generic]")
|
|
108
|
+
.as("testGeneric")
|
|
109
|
+
.then($testGeneric => {
|
|
110
|
+
$testGeneric.append(div);
|
|
111
|
+
|
|
112
|
+
return $testGeneric;
|
|
113
|
+
})
|
|
114
|
+
.then($testGeneric => {
|
|
115
|
+
cy.spy<UI5Element>(($testGeneric.get(0) as UI5Element), "onInvalidation").as("invalidations");
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
cy.get("@invalidations")
|
|
119
|
+
.should("have.not.been.called");
|
|
120
|
+
|
|
121
|
+
cy.wrap(div)
|
|
122
|
+
.then($div => {
|
|
123
|
+
$div.remove();
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
cy.get("@invalidations")
|
|
127
|
+
.should("have.been.called");
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
it("Tests that modifying textContent invalidates", () => {
|
|
131
|
+
cy.mount(`<ui5-test-generic></ui5-test-generic>`);
|
|
132
|
+
|
|
133
|
+
cy.get("[ui5-test-generic]")
|
|
134
|
+
.as("testGeneric")
|
|
135
|
+
.then($testGeneric => {
|
|
136
|
+
$testGeneric.text("test");
|
|
137
|
+
|
|
138
|
+
return $testGeneric;
|
|
139
|
+
})
|
|
140
|
+
.then($testGeneric => {
|
|
141
|
+
cy.spy<UI5Element>(($testGeneric.get(0) as UI5Element), "onInvalidation").as("invalidations");
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
cy.get("@invalidations")
|
|
145
|
+
.should("have.not.been.called");
|
|
146
|
+
|
|
147
|
+
cy.get("@testGeneric")
|
|
148
|
+
.then($testGeneric => {
|
|
149
|
+
$testGeneric.text("test2");
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
cy.get("@invalidations")
|
|
153
|
+
.should("have.been.called");
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
it("Tests that modifying nodeValue invalidates", () => {
|
|
157
|
+
cy.mount(`<ui5-test-generic></ui5-test-generic>`);
|
|
158
|
+
|
|
159
|
+
cy.get("[ui5-test-generic]")
|
|
160
|
+
.as("testGeneric")
|
|
161
|
+
.then($testGeneric => {
|
|
162
|
+
$testGeneric.text("test");
|
|
163
|
+
|
|
164
|
+
return $testGeneric;
|
|
165
|
+
})
|
|
166
|
+
.then($testGeneric => {
|
|
167
|
+
cy.spy<UI5Element>(($testGeneric.get(0) as UI5Element), "onInvalidation").as("invalidations");
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
cy.get("@invalidations")
|
|
171
|
+
.should("have.not.been.called");
|
|
172
|
+
|
|
173
|
+
cy.get("@testGeneric")
|
|
174
|
+
.then($testGeneric => {
|
|
175
|
+
$testGeneric.get(0).childNodes[0].nodeValue = "test2";
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
cy.get("@invalidations")
|
|
179
|
+
.should("have.been.called");
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
it("Tests that multiple invalidations result in a single rendering", () => {
|
|
183
|
+
cy.mount(`<ui5-test-generic></ui5-test-generic>`);
|
|
184
|
+
|
|
185
|
+
cy.get("[ui5-test-generic]")
|
|
186
|
+
.as("testGeneric");
|
|
187
|
+
|
|
188
|
+
cy.get("@testGeneric")
|
|
189
|
+
.then($testGeneric => {
|
|
190
|
+
cy.spy<UI5Element>(($testGeneric.get(0) as UI5Element), "onInvalidation").as("invalidations");
|
|
191
|
+
|
|
192
|
+
cy.spy<UI5Element>(($testGeneric.get(0) as UI5Element), "_render").as("rendering");
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
cy.get("@testGeneric")
|
|
196
|
+
.invoke("prop", "strProp", "new");
|
|
197
|
+
|
|
198
|
+
cy.get("@testGeneric")
|
|
199
|
+
.invoke("prop", "strProp", "new2");
|
|
200
|
+
|
|
201
|
+
cy.get("@invalidations")
|
|
202
|
+
.should("have.been.calledTwice");
|
|
203
|
+
|
|
204
|
+
cy.get("@rendering")
|
|
205
|
+
.should("have.been.calledOnce");
|
|
206
|
+
});
|
|
207
|
+
});
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import type UI5Element from "../../src/UI5Element.js";
|
|
2
|
+
import "../../test/test-elements/Generic.js";
|
|
3
|
+
|
|
4
|
+
describe("Lifecycle works", () => {
|
|
5
|
+
it("Tests that changing a property invalidates", () => {
|
|
6
|
+
const el = document.createElement("ui5-test-generic");
|
|
7
|
+
|
|
8
|
+
cy.mount(`<div id="container"></div>`);
|
|
9
|
+
|
|
10
|
+
cy.spy<UI5Element>((el as UI5Element), "onBeforeRendering").as("onBeforeRendering");
|
|
11
|
+
|
|
12
|
+
cy.spy<UI5Element>((el as UI5Element), "onAfterRendering").as("onAfterRendering");
|
|
13
|
+
|
|
14
|
+
cy.spy<UI5Element>((el as UI5Element), "onEnterDOM").as("onEnterDOM");
|
|
15
|
+
|
|
16
|
+
cy.get("#container")
|
|
17
|
+
.then($container => {
|
|
18
|
+
$container.append(el);
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
cy.get("@onBeforeRendering")
|
|
22
|
+
.should("have.been.called")
|
|
23
|
+
.and("have.been.calledBefore", "@onAfterRendering")
|
|
24
|
+
.and("have.been.calledBefore", "@onEnterDOM");
|
|
25
|
+
|
|
26
|
+
cy.get("@onAfterRendering")
|
|
27
|
+
.should("have.been.called")
|
|
28
|
+
.and("have.been.calledBefore", "@onEnterDOM");
|
|
29
|
+
|
|
30
|
+
cy.get("@onEnterDOM")
|
|
31
|
+
.should("have.been.called");
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
it("Tests element invalidation callbacks", () => {
|
|
35
|
+
cy.mount(`<ui5-test-generic></ui5-test-generic>`);
|
|
36
|
+
|
|
37
|
+
cy.get("[ui5-test-generic]")
|
|
38
|
+
.as("testGeneric")
|
|
39
|
+
.then($testGeneric => {
|
|
40
|
+
cy.spy<UI5Element>(($testGeneric.get(0) as UI5Element), "onBeforeRendering").as("onBeforeRendering");
|
|
41
|
+
|
|
42
|
+
cy.spy<UI5Element>(($testGeneric.get(0) as UI5Element), "onAfterRendering").as("onAfterRendering");
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
cy.get("@testGeneric")
|
|
46
|
+
.invoke("prop", "strProp", "some string");
|
|
47
|
+
|
|
48
|
+
cy.get("@onBeforeRendering")
|
|
49
|
+
.should("have.been.called")
|
|
50
|
+
.and("have.been.calledBefore", "@onAfterRendering");
|
|
51
|
+
|
|
52
|
+
cy.get("@onAfterRendering")
|
|
53
|
+
.should("have.been.called");
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
it("Tests element destruction callback", () => {
|
|
57
|
+
const el = document.createElement("ui5-test-generic");
|
|
58
|
+
|
|
59
|
+
cy.mount(`<div id="container"></div>`);
|
|
60
|
+
|
|
61
|
+
cy.spy<UI5Element>((el as UI5Element), "onExitDOM").as("onExitDOM");
|
|
62
|
+
cy.spy<UI5Element>((el as UI5Element), "onEnterDOM").as("onEnterDOM");
|
|
63
|
+
|
|
64
|
+
cy.get("#container")
|
|
65
|
+
.then($container => {
|
|
66
|
+
$container.append(el);
|
|
67
|
+
|
|
68
|
+
return $container;
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
cy.get("@onEnterDOM")
|
|
72
|
+
.should("have.been.called");
|
|
73
|
+
|
|
74
|
+
cy.wrap(el)
|
|
75
|
+
.then($el => {
|
|
76
|
+
$el.remove();
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
cy.get("@onExitDOM")
|
|
80
|
+
.should("have.been.called");
|
|
81
|
+
});
|
|
82
|
+
});
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type UI5Element from "../../src/UI5Element.js";
|
|
2
|
+
|
|
3
|
+
import "../../test/test-elements/Parent.js";
|
|
4
|
+
import "../../test/test-elements/Child.js";
|
|
5
|
+
|
|
6
|
+
describe("Invalidation works", () => {
|
|
7
|
+
it("Tests that changing a monitored property of a child invalidates the parent", () => {
|
|
8
|
+
cy.mount(`<ui5-test-parent>
|
|
9
|
+
<ui5-test-child></ui5-test-child>
|
|
10
|
+
</ui5-test-parent>`);
|
|
11
|
+
|
|
12
|
+
cy.get("[ui5-test-parent]")
|
|
13
|
+
.as("testParent")
|
|
14
|
+
.then(el => {
|
|
15
|
+
cy.spy<UI5Element>((el.get(0) as UI5Element), "onInvalidation").as("invalidations");
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
cy.get("[ui5-test-child]")
|
|
19
|
+
.invoke("prop", "prop1", "a");
|
|
20
|
+
|
|
21
|
+
cy.get("@invalidations")
|
|
22
|
+
.should("have.been.called");
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it("Tests that changing a non-monitored property of a child does not invalidate the parent", () => {
|
|
26
|
+
cy.mount(`<ui5-test-parent>
|
|
27
|
+
<ui5-test-child></ui5-test-child>
|
|
28
|
+
</ui5-test-parent>`);
|
|
29
|
+
|
|
30
|
+
cy.get("[ui5-test-parent]")
|
|
31
|
+
.as("testParent")
|
|
32
|
+
.then(el => {
|
|
33
|
+
cy.spy<UI5Element>((el.get(0) as UI5Element), "onInvalidation").as("invalidations");
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
cy.get("[ui5-test-child]")
|
|
37
|
+
.invoke("prop", "prop2", "b");
|
|
38
|
+
|
|
39
|
+
cy.get("@invalidations")
|
|
40
|
+
.should("have.not.been.called");
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
it("Tests that changing a non-monitored property of a child does not invalidate the parent", () => {
|
|
44
|
+
cy.mount(`<ui5-test-parent>
|
|
45
|
+
<ui5-test-child slot="items"></ui5-test-child>
|
|
46
|
+
</ui5-test-parent>`);
|
|
47
|
+
|
|
48
|
+
cy.get("[ui5-test-parent]")
|
|
49
|
+
.as("testParent")
|
|
50
|
+
.then(el => {
|
|
51
|
+
cy.spy<UI5Element>((el.get(0) as UI5Element), "onInvalidation").as("invalidations");
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
cy.get("[ui5-test-child]")
|
|
55
|
+
.invoke("prop", "prop1", "a")
|
|
56
|
+
.invoke("prop", "prop2", "b")
|
|
57
|
+
.invoke("prop", "prop3", "c");
|
|
58
|
+
|
|
59
|
+
cy.get("@invalidations")
|
|
60
|
+
.should("have.been.calledThrice");
|
|
61
|
+
});
|
|
62
|
+
});
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type UI5Element from "../../src/UI5Element.js";
|
|
2
|
+
import "../../test/test-elements/GenericExt.js";
|
|
3
|
+
|
|
4
|
+
describe("Invalidation works", () => {
|
|
5
|
+
it("Tests that changing a monitored property of a child invalidates the parent", () => {
|
|
6
|
+
cy.mount(`<ui5-test-generic-ext></ui5-test-generic-ext>`);
|
|
7
|
+
|
|
8
|
+
cy.get("[ui5-test-generic-ext]")
|
|
9
|
+
.then($el => {
|
|
10
|
+
return ($el.get(0).constructor as typeof UI5Element).getMetadata();
|
|
11
|
+
})
|
|
12
|
+
.as("metadata");
|
|
13
|
+
|
|
14
|
+
cy.get("@metadata")
|
|
15
|
+
.invoke("getProperties")
|
|
16
|
+
.its("strProp")
|
|
17
|
+
.should("exist");
|
|
18
|
+
|
|
19
|
+
cy.get("@metadata")
|
|
20
|
+
.invoke("getProperties")
|
|
21
|
+
.its("extProp")
|
|
22
|
+
.should("exist");
|
|
23
|
+
|
|
24
|
+
cy.get("@metadata")
|
|
25
|
+
.invoke("getSlots")
|
|
26
|
+
.its("default")
|
|
27
|
+
.should("exist");
|
|
28
|
+
|
|
29
|
+
cy.get("@metadata")
|
|
30
|
+
.invoke("getSlots")
|
|
31
|
+
.its("extSlot")
|
|
32
|
+
.should("exist");
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it("When extending metadata, property defaultValue can be modified", () => {
|
|
36
|
+
cy.mount(`<ui5-test-generic-ext></ui5-test-generic-ext>`);
|
|
37
|
+
|
|
38
|
+
cy.get("[ui5-test-generic-ext]")
|
|
39
|
+
.invoke("attr", "str-prop")
|
|
40
|
+
.should("equal", "Ext");
|
|
41
|
+
});
|
|
42
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import "../../test/test-elements/Generic.js";
|
|
2
|
+
|
|
3
|
+
describe("Properties can only have values, restricted to their types", () => {
|
|
4
|
+
it("String property enforced to string", () => {
|
|
5
|
+
cy.mount(`<ui5-test-generic></ui5-test-generic>`);
|
|
6
|
+
|
|
7
|
+
cy.get("[ui5-test-generic]")
|
|
8
|
+
.as("testGeneric");
|
|
9
|
+
|
|
10
|
+
cy.get("@testGeneric")
|
|
11
|
+
.invoke("prop", "strProp", 5);
|
|
12
|
+
|
|
13
|
+
cy.get("@testGeneric")
|
|
14
|
+
.invoke("prop", "strProp")
|
|
15
|
+
.should("equal", 5);
|
|
16
|
+
});
|
|
17
|
+
});
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import "../../test/test-elements/Generic.js";
|
|
2
|
+
|
|
3
|
+
describe("Properties and attributes convert to each other", () => {
|
|
4
|
+
it("Tests that properties with default values are initialized with the default value", () => {
|
|
5
|
+
cy.mount(`<ui5-test-generic></ui5-test-generic>`);
|
|
6
|
+
|
|
7
|
+
cy.get("[ui5-test-generic]")
|
|
8
|
+
.as("testGeneric");
|
|
9
|
+
|
|
10
|
+
cy.get("@testGeneric")
|
|
11
|
+
.invoke("prop", "defaultValueProp")
|
|
12
|
+
.should("equal", "Hello");
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
it("Tests that prop-attr conversion works for string properties", () => {
|
|
16
|
+
cy.mount(`<ui5-test-generic></ui5-test-generic>`);
|
|
17
|
+
|
|
18
|
+
cy.get("[ui5-test-generic]")
|
|
19
|
+
.as("testGeneric");
|
|
20
|
+
|
|
21
|
+
cy.get("@testGeneric")
|
|
22
|
+
.invoke("prop", "strProp", "test1");
|
|
23
|
+
|
|
24
|
+
cy.get("@testGeneric")
|
|
25
|
+
.should("have.attr", "str-prop", "test1");
|
|
26
|
+
|
|
27
|
+
cy.get("@testGeneric")
|
|
28
|
+
.invoke("attr", "str-prop", "test2");
|
|
29
|
+
|
|
30
|
+
cy.get("@testGeneric")
|
|
31
|
+
.invoke("prop", "strProp")
|
|
32
|
+
.should("equal", "test2");
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it("Tests that prop-attr conversion works for boolean properties", () => {
|
|
36
|
+
cy.mount(`<ui5-test-generic></ui5-test-generic>`);
|
|
37
|
+
|
|
38
|
+
cy.get("[ui5-test-generic]")
|
|
39
|
+
.as("testGeneric");
|
|
40
|
+
|
|
41
|
+
cy.get("@testGeneric")
|
|
42
|
+
.invoke("prop", "boolProp", true);
|
|
43
|
+
|
|
44
|
+
cy.get("@testGeneric")
|
|
45
|
+
.should("have.attr", "bool-prop");
|
|
46
|
+
|
|
47
|
+
cy.get("@testGeneric")
|
|
48
|
+
.invoke("prop", "boolProp", false);
|
|
49
|
+
|
|
50
|
+
cy.get("@testGeneric")
|
|
51
|
+
.should("not.have.attr", "bool-prop");
|
|
52
|
+
|
|
53
|
+
cy.get("@testGeneric")
|
|
54
|
+
.invoke("attr", "bool-prop", true);
|
|
55
|
+
|
|
56
|
+
cy.get("@testGeneric")
|
|
57
|
+
.invoke("prop", "boolProp")
|
|
58
|
+
.should("be.true");
|
|
59
|
+
|
|
60
|
+
cy.get("@testGeneric")
|
|
61
|
+
.invoke("removeAttr", "bool-prop");
|
|
62
|
+
|
|
63
|
+
cy.get("@testGeneric")
|
|
64
|
+
.invoke("prop", "boolProp")
|
|
65
|
+
.should("be.false");
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
it("Tests that object properties have no attributes", () => {
|
|
69
|
+
cy.mount(`<ui5-test-generic></ui5-test-generic>`);
|
|
70
|
+
|
|
71
|
+
cy.get("[ui5-test-generic]")
|
|
72
|
+
.as("testGeneric");
|
|
73
|
+
|
|
74
|
+
cy.get("@testGeneric")
|
|
75
|
+
.invoke("prop", "objectProp", {});
|
|
76
|
+
|
|
77
|
+
cy.get("@testGeneric")
|
|
78
|
+
.should("not.have.attr", "object-prop");
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
it("Tests that array properties have no attributes", () => {
|
|
82
|
+
cy.mount(`<ui5-test-generic></ui5-test-generic>`);
|
|
83
|
+
|
|
84
|
+
cy.get("[ui5-test-generic]")
|
|
85
|
+
.as("testGeneric");
|
|
86
|
+
|
|
87
|
+
cy.get("@testGeneric")
|
|
88
|
+
.invoke("prop", "multiProp", ["a", "b"]);
|
|
89
|
+
|
|
90
|
+
cy.get("@testGeneric")
|
|
91
|
+
.should("not.have.attr", "multi-prop");
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
it("Tests that noAttribute properties have no attributes", () => {
|
|
95
|
+
cy.mount(`<ui5-test-generic></ui5-test-generic>`);
|
|
96
|
+
|
|
97
|
+
cy.get("[ui5-test-generic]")
|
|
98
|
+
.as("testGeneric");
|
|
99
|
+
|
|
100
|
+
cy.get("@testGeneric")
|
|
101
|
+
.invoke("prop", "noAttributeProp", "some value");
|
|
102
|
+
|
|
103
|
+
cy.get("@testGeneric")
|
|
104
|
+
.should("not.have.attr", "no-attribute-prop");
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
it("Tests that properties with default values do automatically set attributes", () => {
|
|
108
|
+
cy.mount(`<ui5-test-generic></ui5-test-generic>`);
|
|
109
|
+
|
|
110
|
+
cy.get("[ui5-test-generic]")
|
|
111
|
+
.should("have.attr", "default-value-prop", "Hello");
|
|
112
|
+
});
|
|
113
|
+
});
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import "../../test/test-elements/Generic.js";
|
|
2
|
+
import "../../test/test-elements/NoShadowDOM.js";
|
|
3
|
+
|
|
4
|
+
describe("The framework can define web components", () => {
|
|
5
|
+
it("Tests that element's Shadow DOM is rendered if it has a template", () => {
|
|
6
|
+
cy.mount(`<ui5-test-generic></ui5-test-generic>`);
|
|
7
|
+
|
|
8
|
+
cy.get("[ui5-test-generic]")
|
|
9
|
+
.as("testGeneric")
|
|
10
|
+
.then($element => {
|
|
11
|
+
return !!$element.get(0).shadowRoot;
|
|
12
|
+
})
|
|
13
|
+
.should("be.true");
|
|
14
|
+
|
|
15
|
+
cy.get("@testGeneric")
|
|
16
|
+
.shadow()
|
|
17
|
+
.find("div > p")
|
|
18
|
+
.should("exist");
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
it("Tests that element's Shadow DOM is not rendered if it has no template", () => {
|
|
22
|
+
cy.mount(`<ui5-test-no-shadow></ui5-test-no-shadow>`);
|
|
23
|
+
|
|
24
|
+
cy.get("[ui5-test-no-shadow]")
|
|
25
|
+
.then($element => {
|
|
26
|
+
return !!$element.get(0).shadowRoot;
|
|
27
|
+
})
|
|
28
|
+
.should("be.false");
|
|
29
|
+
});
|
|
30
|
+
});
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import "../../test/test-elements/Generic.js";
|
|
2
|
+
|
|
3
|
+
describe("Slots work properly", () => {
|
|
4
|
+
it("Tests that properties exist on the element for each slot", () => {
|
|
5
|
+
cy.mount(`<ui5-test-generic>
|
|
6
|
+
Default slot text
|
|
7
|
+
<span>Default slot content</span>
|
|
8
|
+
<span slot="other">Other slot content 1</span>
|
|
9
|
+
<span slot="other">Other slot content 2</span>
|
|
10
|
+
<span slot="individual">Individual slot content 1</span>
|
|
11
|
+
<span slot="individual">Individual slot content 2</span>
|
|
12
|
+
<span slot="named">Item in slot with propertyName</span>
|
|
13
|
+
<span slot="named">Item in slot with propertyName</span>
|
|
14
|
+
<span slot="row-header">Item in slot row-header</span>
|
|
15
|
+
<span slot="row-header">Item in slot row-header</span>
|
|
16
|
+
</ui5-test-generic>
|
|
17
|
+
`);
|
|
18
|
+
|
|
19
|
+
cy.get("[ui5-test-generic]")
|
|
20
|
+
.as("testGeneric");
|
|
21
|
+
|
|
22
|
+
cy.get("@testGeneric")
|
|
23
|
+
.invoke("prop", "content")
|
|
24
|
+
.then(value => {
|
|
25
|
+
return (value as Array<unknown>).length;
|
|
26
|
+
})
|
|
27
|
+
.should("be.greaterThan", 0);
|
|
28
|
+
|
|
29
|
+
cy.get("@testGeneric")
|
|
30
|
+
.invoke("prop", "other")
|
|
31
|
+
.should("have.length", 2);
|
|
32
|
+
|
|
33
|
+
cy.get("@testGeneric")
|
|
34
|
+
.invoke("prop", "individual")
|
|
35
|
+
.should("have.length", 2);
|
|
36
|
+
|
|
37
|
+
cy.get("@testGeneric")
|
|
38
|
+
.invoke("prop", "row-header")
|
|
39
|
+
.should("have.length", 2);
|
|
40
|
+
|
|
41
|
+
cy.get("@testGeneric")
|
|
42
|
+
.invoke("prop", "named")
|
|
43
|
+
.should("be.undefined");
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
it("Tests that properties exist on the element for each slot", () => {
|
|
47
|
+
cy.mount(`<ui5-test-generic>
|
|
48
|
+
<span slot="individual">Individual slot content 1</span>
|
|
49
|
+
<span slot="individual">Individual slot content 2</span>
|
|
50
|
+
</ui5-test-generic>
|
|
51
|
+
`);
|
|
52
|
+
|
|
53
|
+
cy.get("[slot=individual]")
|
|
54
|
+
.should("not.exist");
|
|
55
|
+
|
|
56
|
+
cy.get("[slot=individual-1]")
|
|
57
|
+
.should("exist");
|
|
58
|
+
|
|
59
|
+
cy.get("[slot=individual-2]")
|
|
60
|
+
.should("exist");
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
it("Tests that changing the slot attribute of children redistributes them across slot accessors", () => {
|
|
64
|
+
let defaultSlotLength = 0;
|
|
65
|
+
|
|
66
|
+
cy.mount(`<ui5-test-generic>
|
|
67
|
+
<span>Default slot content</span>
|
|
68
|
+
<span slot="other" id="o1">Other slot content 1</span>
|
|
69
|
+
<span slot="other" id="o2">Other slot content 2</span>
|
|
70
|
+
<span slot="named">Item in slot with propertyName</span>
|
|
71
|
+
<span slot="named">Item in slot with propertyName</span>
|
|
72
|
+
</ui5-test-generic>
|
|
73
|
+
`);
|
|
74
|
+
|
|
75
|
+
cy.get("[ui5-test-generic]")
|
|
76
|
+
.as("testGeneric");
|
|
77
|
+
|
|
78
|
+
cy.get("@testGeneric")
|
|
79
|
+
.invoke("prop", "content")
|
|
80
|
+
.then(value => {
|
|
81
|
+
defaultSlotLength = value.length;
|
|
82
|
+
|
|
83
|
+
return defaultSlotLength;
|
|
84
|
+
})
|
|
85
|
+
.should("be.greaterThan", 0);
|
|
86
|
+
|
|
87
|
+
cy.get("@testGeneric")
|
|
88
|
+
.invoke("prop", "other")
|
|
89
|
+
.should("have.length", 2);
|
|
90
|
+
|
|
91
|
+
cy.get("@testGeneric")
|
|
92
|
+
.invoke("prop", "items")
|
|
93
|
+
.should("have.length", 2);
|
|
94
|
+
|
|
95
|
+
cy.get("#o1")
|
|
96
|
+
.invoke("removeAttr", "slot");
|
|
97
|
+
|
|
98
|
+
cy.get("#o2")
|
|
99
|
+
.invoke("attr", "slot", "named");
|
|
100
|
+
|
|
101
|
+
cy.get("@testGeneric")
|
|
102
|
+
.then($testGeneric => {
|
|
103
|
+
cy.wrap($testGeneric)
|
|
104
|
+
.invoke("prop", "content")
|
|
105
|
+
.should("have.length", defaultSlotLength + 1);
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
cy.get("@testGeneric")
|
|
109
|
+
.invoke("prop", "other")
|
|
110
|
+
.should("have.length", 0);
|
|
111
|
+
|
|
112
|
+
cy.get("@testGeneric")
|
|
113
|
+
.invoke("prop", "items")
|
|
114
|
+
.should("have.length", 3);
|
|
115
|
+
});
|
|
116
|
+
});
|