@ui5/webcomponents-base 1.4.0 → 1.5.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.
Files changed (59) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +27 -6
  3. package/bundle.esm.js +7 -9
  4. package/dist/CustomElementsRegistry.js +1 -1
  5. package/dist/asset-registries/LocaleData.js +1 -1
  6. package/dist/asset-registries/i18n.js +3 -1
  7. package/dist/assets/bundle.esm.a812dc7f.js +43 -0
  8. package/dist/delegate/ItemNavigation.js +9 -4
  9. package/dist/features/F6Navigation.js +4 -0
  10. package/dist/generated/VersionInfo.js +3 -3
  11. package/dist/updateShadowRoot.js +1 -2
  12. package/dist/util/Caret.js +1 -14
  13. package/dist/util/isDefaultSlotProvided.js +11 -0
  14. package/package-scripts.js +14 -16
  15. package/package.json +4 -3
  16. package/src/CustomElementsRegistry.js +1 -1
  17. package/src/asset-registries/LocaleData.js +1 -1
  18. package/src/asset-registries/i18n.js +3 -1
  19. package/src/delegate/ItemNavigation.js +9 -4
  20. package/src/features/F6Navigation.js +4 -0
  21. package/src/updateShadowRoot.js +1 -2
  22. package/src/util/Caret.js +1 -14
  23. package/src/util/isDefaultSlotProvided.js +11 -0
  24. package/config/.eslintrc.js +0 -3
  25. package/config/rollup.config.js +0 -1
  26. package/dist/isLegacyBrowser.js +0 -3
  27. package/dist/resources/bundle.esm.js +0 -32
  28. package/dist/resources/bundle.esm.js.map +0 -1
  29. package/dist/test-resources/assets/Themes.js +0 -17
  30. package/dist/test-resources/elements/Child.js +0 -35
  31. package/dist/test-resources/elements/Generic.js +0 -84
  32. package/dist/test-resources/elements/GenericExt.js +0 -26
  33. package/dist/test-resources/elements/NoShadowDOM.js +0 -13
  34. package/dist/test-resources/elements/Parent.js +0 -41
  35. package/dist/test-resources/elements/WithStaticArea.js +0 -77
  36. package/dist/test-resources/pages/AllTestElements.html +0 -42
  37. package/dist/test-resources/pages/Configuration.html +0 -18
  38. package/dist/test-resources/pages/ConfigurationScript.html +0 -34
  39. package/dist/test-resources/pages/assets/messagebundle_de.properties +0 -1
  40. package/dist/test-resources/pages/assets/messagebundle_en.properties +0 -1
  41. package/dist/test-resources/pages/assets/messagebundle_es.properties +0 -1
  42. package/dist/test-resources/pages/assets/messagebundle_fr.properties +0 -1
  43. package/dist/test-resources/pages/i18n.html +0 -33
  44. package/dist/test-resources/specs/ConfigurationChange.spec.js +0 -27
  45. package/dist/test-resources/specs/ConfigurationScript.spec.js +0 -63
  46. package/dist/test-resources/specs/ConfigurationURL.spec.js +0 -93
  47. package/dist/test-resources/specs/CustomTheme.spec.js +0 -27
  48. package/dist/test-resources/specs/EventProvider.spec.js +0 -63
  49. package/dist/test-resources/specs/StaticArea.spec.js +0 -78
  50. package/dist/test-resources/specs/Theming.spec.js +0 -44
  51. package/dist/test-resources/specs/UI5ElementInvalidation.js +0 -242
  52. package/dist/test-resources/specs/UI5ElementLifecycle.js +0 -98
  53. package/dist/test-resources/specs/UI5ElementListenForChildPropChanges.spec.js +0 -75
  54. package/dist/test-resources/specs/UI5ElementMetadataExt.js +0 -42
  55. package/dist/test-resources/specs/UI5ElementPropertyValidation.js +0 -14
  56. package/dist/test-resources/specs/UI5ElementPropsAndAttrs.spec.js +0 -67
  57. package/dist/test-resources/specs/UI5ElementShadowDOM.js +0 -24
  58. package/dist/test-resources/specs/UI5ElementSlots.js +0 -36
  59. package/src/isLegacyBrowser.js +0 -3
@@ -1,63 +0,0 @@
1
- const assert = require("chai").assert;
2
-
3
- describe("Event provider attaches and detaches listeners properly", () => {
4
- before(async () => {
5
- await browser.url("http://localhost:9191/test-resources/pages/AllTestElements.html");
6
- });
7
-
8
- it("Tests that listeners can be removed (1 listener)", async () => {
9
-
10
- const res = await browser.executeAsync(done => {
11
- let timesCalled = 0;
12
- const ep = new window["sap-ui-webcomponents-bundle"].EventProvider();
13
- const callback = () => {
14
- timesCalled++;
15
- };
16
-
17
- // Setup
18
- ep.attachEvent("test", callback);
19
-
20
- // Act
21
- ep.fireEvent("test"); // should execute the callback and increase the counter
22
-
23
- // Setup
24
- ep.detachEvent("test", callback);
25
-
26
- // Act
27
- ep.fireEvent("test"); // should not execute the callback and increase the counter
28
-
29
- done(timesCalled);
30
- });
31
-
32
- assert.strictEqual(res, 1, "The callback should be called exactly once");
33
- });
34
-
35
- it("Tests that listeners can be removed (more than 1 listener)", async () => {
36
-
37
- const res = await browser.executeAsync(done => {
38
- let timesCalled = 0;
39
- const ep = new window["sap-ui-webcomponents-bundle"].EventProvider();
40
- const callback = () => {
41
- timesCalled++;
42
- };
43
- const somePreviousCallback = () => {};
44
-
45
- // Setup
46
- ep.attachEvent("test", somePreviousCallback); // Attach something so that after detachEvent the listeners array is not empty!
47
- ep.attachEvent("test", callback);
48
-
49
- // Act
50
- ep.fireEvent("test"); // should execute the callback and increase the counter
51
-
52
- // Setup
53
- ep.detachEvent("test", callback);
54
-
55
- // Act
56
- ep.fireEvent("test"); // should not execute the callback and increase the counter
57
-
58
- done(timesCalled);
59
- });
60
-
61
- assert.strictEqual(res, 1, "The callback should be called exactly once");
62
- });
63
- });
@@ -1,78 +0,0 @@
1
- const assert = require("chai").assert;
2
-
3
- describe("Some configuration options can be changed at runtime", () => {
4
- before(async () => {
5
- await browser.url("http://localhost:9191/test-resources/pages/AllTestElements.html");
6
- });
7
-
8
- it("Tests control with no static area item", async () => {
9
- const componentId = await browser.$("#no-static-area").getProperty("_id");
10
- const staticArea = await browser.$("ui5-static-area");
11
-
12
- assert.notOk(await staticArea.$(`.${componentId}`).isExisting(), "No static area item is defined for this control");
13
- });
14
-
15
- it("Tests control with static area item", async () => {
16
- const componentId = await browser.$("#with-static-area").getProperty("_id");
17
- const staticArea = await browser.$("ui5-static-area");
18
-
19
- assert.ok(await staticArea.$(`.${componentId}`).isExisting(), "No static area item is defined for this control");
20
- });
21
-
22
- it("Tests removing an element with static area", async () => {
23
- const result = await browser.executeAsync(done => {
24
- let res = true;
25
- window.onerror = (errorMsg, url, lineNumber) => {
26
- res = false;
27
- }
28
-
29
- document.querySelector("#no-static-area").remove();
30
-
31
- done(res);
32
- });
33
-
34
- assert.ok(result, "Static area removed from DOM successfully");
35
- });
36
-
37
- it("Test RTL not set for static area items", async () => {
38
- const componentId = await browser.$("#with-static-area").getProperty("_id");
39
- const staticArea = await browser.$("ui5-static-area");
40
-
41
- assert.notOk(await staticArea.$(`.${componentId}`).getAttribute("dir"), "dir attribute not set for static area item");
42
- });
43
-
44
- it("Test RTL set for static area items", async () => {
45
- const componentId = await browser.$("#with-static-area-rtl").getProperty("_id");
46
- const staticArea = await browser.$("ui5-static-area");
47
-
48
- assert.equal(await staticArea.$(`.${componentId}`).getAttribute("dir"), "rtl", "dir property correctly set for static area item");
49
- });
50
-
51
- it("Test setting RTL for a static area item owner", async () => {
52
- const componentId = await browser.$("#with-static-area").getProperty("_id");
53
- const staticArea = await browser.$("ui5-static-area");
54
-
55
- await browser.$("#with-static-area").setAttribute("dir", "rtl");
56
- await browser.executeAsync( async (done) => {
57
- await window["sap-ui-webcomponents-bundle"].applyDirection();
58
- await window["sap-ui-webcomponents-bundle"].renderFinished();
59
-
60
- done();
61
- });
62
- assert.equal(await staticArea.$(`.${componentId}`).getAttribute("dir"), "rtl", "dir attribute dynamically set for static area item owner");
63
- });
64
-
65
- it("Test removing RTL for a static area item owner", async () => {
66
- const componentId = await browser.$("#with-static-area-rtl").getProperty("_id");
67
- const staticArea = await browser.$("ui5-static-area");
68
-
69
- await browser.$("#with-static-area-rtl-container").removeAttribute("dir");
70
- await browser.executeAsync( async (done) => {
71
- await window["sap-ui-webcomponents-bundle"].applyDirection();
72
- await window["sap-ui-webcomponents-bundle"].renderFinished();
73
-
74
- done();
75
- });
76
- assert.notOk(await staticArea.$(`.${componentId}`).getAttribute("dir"), "dir attribute dynamically removed for static area item owner");
77
- });
78
- });
@@ -1,44 +0,0 @@
1
- const assert = require("chai").assert;
2
-
3
- describe("Theming works", () => {
4
- before(async () => {
5
- await browser.url("http://localhost:9191/test-resources/pages/AllTestElements.html");
6
- });
7
-
8
- it("Tests that the parameters for the default theme are embedded on boot", async () => {
9
-
10
- const res = await browser.executeAsync(done => {
11
- const style = document.adoptedStyleSheets.find(sh => sh._ui5StyleId === "data-ui5-theme-properties|@ui5/webcomponents-base-test").cssRules[0].cssText
12
- done(style && style.includes("--var1: red")); // see test/assets/Themes.js
13
- });
14
-
15
- assert.strictEqual(res, true, "The fiori3 vars are found");
16
- });
17
-
18
- it("Tests that theme parameters are changed on theme change", async () => {
19
- const newTheme = 'sap_belize_hcb';
20
-
21
- const res = await browser.executeAsync( async (newTheme, done) => {
22
- const config = window['sap-ui-webcomponents-bundle'].configuration;
23
- await config.setTheme(newTheme);
24
-
25
- const style = document.adoptedStyleSheets.find(sh => sh._ui5StyleId === "data-ui5-theme-properties|@ui5/webcomponents-base-test").cssRules[0].cssText
26
- const varsFound = style && style.includes("--var1: orange"); // see test/assets/Themes.js
27
- done(varsFound);
28
- }, newTheme);
29
-
30
- assert.strictEqual(res, true, "Theme parameters changed");
31
- });
32
-
33
- it("Tests fallback to default theme when setting unknown theme", async () => {
34
- const unknownTheme = 'sap_unknown_theme';
35
- await browser.url(`http://localhost:9191/test-resources/pages/AllTestElements.html?sap-ui-theme=${unknownTheme}`);
36
-
37
- const res = await browser.executeAsync( async (done) => {
38
- const cssVarValue = getComputedStyle(document.documentElement).getPropertyValue('--var1');
39
- done(cssVarValue);
40
- });
41
-
42
- assert.strictEqual(res, ' red', "Default theme parameters loaded");
43
- });
44
- });
@@ -1,242 +0,0 @@
1
- const assert = require("chai").assert;
2
-
3
- describe("Invalidation works", () => {
4
- before(async () => {
5
- await browser.url("http://localhost:9191/test-resources/pages/AllTestElements.html");
6
- });
7
-
8
- it("Tests that changing a property invalidates", async () => {
9
-
10
- const res = await browser.executeAsync( async (done) => {
11
-
12
- const el = document.getElementById("gen");
13
-
14
- // Exactly 1 invalidation for each property change
15
- let invalidations = 0;
16
-
17
- el.onInvalidation = () => {
18
- invalidations++;
19
- };
20
-
21
- el.strProp = "new value";
22
- el.boolProp = true;
23
-
24
- await window["sap-ui-webcomponents-bundle"].renderFinished();
25
-
26
- done(invalidations);
27
- });
28
-
29
- assert.strictEqual(res, 2, "Invalidated 2 times");
30
- });
31
-
32
- it("Tests that setting a property to the same value does not invalidate", async () => {
33
-
34
- const res = await browser.executeAsync( async (done) => {
35
- const text = "some value";
36
-
37
- const el = document.getElementById("gen");
38
- el.strProp = text;
39
- await window["sap-ui-webcomponents-bundle"].renderFinished();
40
-
41
- let invalidations = 0;
42
-
43
- el.onInvalidation = () => {
44
- invalidations++;
45
- };
46
-
47
- el.strProp = text;
48
-
49
- await window["sap-ui-webcomponents-bundle"].renderFinished();
50
-
51
- done(invalidations);
52
- });
53
-
54
- assert.strictEqual(res, 0, "Not invalidated");
55
- });
56
-
57
- it("Tests that setting a property of type Object always invalidates", async () => {
58
-
59
- const res = await browser.executeAsync( async (done) => {
60
- const obj = {};
61
- const otherObj = {};
62
-
63
- const el = document.getElementById("gen");
64
- el.objectProp = obj;
65
- await window["sap-ui-webcomponents-bundle"].renderFinished();
66
-
67
- let invalidations = 0;
68
-
69
- el.onInvalidation = () => {
70
- invalidations++;
71
- };
72
-
73
- el.objectProp = otherObj;
74
-
75
- await window["sap-ui-webcomponents-bundle"].renderFinished();
76
-
77
- done(invalidations);
78
- });
79
-
80
- assert.strictEqual(res, 1, "Invalidated");
81
- });
82
-
83
- it("Tests that setting an array property always invalidates", async () => {
84
-
85
- const res = await browser.executeAsync( async (done) => {
86
- const arr = [];
87
- const otherArr = [];
88
-
89
- const el = document.getElementById("gen");
90
- el.multiProp = arr;
91
- await window["sap-ui-webcomponents-bundle"].renderFinished();
92
-
93
- let invalidations = 0;
94
-
95
- el.onInvalidation = () => {
96
- invalidations++;
97
- };
98
-
99
- el.multiProp = otherArr;
100
-
101
- await window["sap-ui-webcomponents-bundle"].renderFinished();
102
-
103
- done(invalidations);
104
- });
105
-
106
- assert.strictEqual(res, 1, "Invalidated");
107
- });
108
-
109
- it("Tests that adding a child invalidates", async () => {
110
-
111
- const res = await browser.executeAsync( async (done) => {
112
-
113
- const el = document.getElementById("gen");
114
-
115
- // Number of invalidations may vary with children/slots count, so just check for invalidation
116
- let invalidated = false;
117
-
118
- el.onInvalidation = () => {
119
- invalidated = true;
120
- };
121
-
122
- const div = document.createElement("div");
123
- el.appendChild(div);
124
-
125
- await window["sap-ui-webcomponents-bundle"].renderFinished();
126
-
127
- done(invalidated);
128
- });
129
-
130
- assert.strictEqual(res, true, "Invalidated");
131
- });
132
-
133
- it("Tests that removing a child invalidates", async () => {
134
-
135
- const res = await browser.executeAsync( async (done) => {
136
-
137
- const el = document.getElementById("gen");
138
- const div = document.createElement("div");
139
- el.appendChild(div);
140
-
141
- await window["sap-ui-webcomponents-bundle"].renderFinished();
142
-
143
- let invalidated = false;
144
-
145
- el.onInvalidation = () => {
146
- invalidated = true;
147
- };
148
-
149
- el.removeChild(div);
150
-
151
- await window["sap-ui-webcomponents-bundle"].renderFinished();
152
-
153
- done(invalidated);
154
- });
155
-
156
- assert.strictEqual(res, true, "Invalidated");
157
- });
158
-
159
- it("Tests that modifying textContent invalidates", async () => {
160
-
161
- const res = await browser.executeAsync( async (done) => {
162
-
163
- const el = document.getElementById("gen");
164
- el.textContent = "test";
165
- await window["sap-ui-webcomponents-bundle"].renderFinished();
166
-
167
- // Number of invalidations may vary with children/slots count, so just check for invalidation
168
- let invalidated = false;
169
-
170
- el.onInvalidation = () => {
171
- invalidated = true;
172
- };
173
-
174
- el.textContent = "test2";
175
-
176
- await window["sap-ui-webcomponents-bundle"].renderFinished();
177
-
178
- done(invalidated);
179
- });
180
-
181
- assert.strictEqual(res, true, "Invalidated");
182
- });
183
-
184
- it("Tests that modifying nodeValue invalidates", async () => {
185
-
186
- const res = await browser.executeAsync( async (done) => {
187
-
188
- const el = document.getElementById("gen");
189
- el.textContent = "test";
190
- await window["sap-ui-webcomponents-bundle"].renderFinished();
191
-
192
- // Number of invalidations may vary with children/slots count, so just check for invalidation
193
- let invalidated = false;
194
-
195
- el.onInvalidation = () => {
196
- invalidated = true;
197
- };
198
-
199
- el.childNodes[0].nodeValue = "test2";
200
-
201
- await window["sap-ui-webcomponents-bundle"].renderFinished();
202
-
203
- done(invalidated);
204
- });
205
-
206
- assert.strictEqual(res, true, "Invalidated");
207
- });
208
-
209
- it("Tests that multiple invalidations result in a single rendering", async () => {
210
-
211
- const res = await browser.executeAsync( async (done) => {
212
-
213
- const el = document.getElementById("gen");
214
-
215
- const operations = {
216
- invalidation: 0,
217
- rendering: 0,
218
- };
219
-
220
- el.onInvalidation = () => {
221
- operations.invalidation++;
222
- };
223
-
224
- const originalRender = el._render;
225
- el._render = () => {
226
- originalRender.apply(el, arguments);
227
- operations.rendering++;
228
- };
229
-
230
- el.strProp = "new";
231
- el.strProp = "newer";
232
-
233
- await window["sap-ui-webcomponents-bundle"].renderFinished();
234
-
235
- done(operations);
236
- });
237
-
238
- assert.strictEqual(res.invalidation, 2, "Invalidated 2 times");
239
- assert.strictEqual(res.rendering, 1, "Rendered once");
240
- });
241
-
242
- });
@@ -1,98 +0,0 @@
1
- const assert = require("chai").assert;
2
-
3
- describe("Lifecycle works", () => {
4
- before(async () => {
5
- await browser.url("http://localhost:9191/test-resources/pages/AllTestElements.html");
6
- });
7
-
8
- it("Tests element creation callbacks", async () => {
9
-
10
- const res = await browser.executeAsync( async (done) => {
11
- const creationCallbacks = ["onBeforeRendering", "onAfterRendering", "onEnterDOM"];
12
- const calledCallbacks = [];
13
-
14
- const el = document.createElement("ui5-test-generic");
15
-
16
- creationCallbacks.forEach(callback => {
17
- const original = el[callback];
18
- el[callback] = () => {
19
- calledCallbacks.push(callback);
20
- original.call(el);
21
- };
22
- });
23
-
24
- document.body.appendChild(el);
25
- await window["sap-ui-webcomponents-bundle"].renderFinished();
26
-
27
- done(calledCallbacks);
28
- });
29
-
30
- assert.strictEqual(res.length, 3, "All 3 callbacks called");
31
- assert.strictEqual(res[0], "onBeforeRendering", "onBeforeRendering called first");
32
- assert.strictEqual(res[1], "onAfterRendering", "onAfterRendering called second");
33
- assert.strictEqual(res[2], "onEnterDOM", "onEnterDOM called third");
34
- });
35
-
36
- it("Tests element invalidation callbacks", async () => {
37
-
38
- const res = await browser.executeAsync( async (done) => {
39
- const invalidationCallbacks = ["onBeforeRendering", "onAfterRendering"];
40
- const calledCallbacks = [];
41
-
42
- const el = document.createElement("ui5-test-generic");
43
- document.body.appendChild(el);
44
-
45
- await window["sap-ui-webcomponents-bundle"].renderFinished();
46
-
47
- el.strProp = "some string";
48
-
49
- invalidationCallbacks.forEach(callback => {
50
- const original = el[callback];
51
- el[callback] = () => {
52
- calledCallbacks.push(callback);
53
- original.call(el);
54
- };
55
- });
56
-
57
- await window["sap-ui-webcomponents-bundle"].renderFinished();
58
-
59
- done(calledCallbacks);
60
- });
61
-
62
- assert.strictEqual(res.length, 2, "All 2 callbacks called");
63
- assert.strictEqual(res[0], "onBeforeRendering", "onBeforeRendering called first");
64
- assert.strictEqual(res[1], "onAfterRendering", "onAfterRendering called second");
65
- });
66
-
67
- it("Tests element destruction callback", async () => {
68
-
69
- const res = await browser.executeAsync( async (done) => {
70
- const destructionCallbacks = ["onExitDOM"];
71
- const calledCallbacks = [];
72
-
73
- const el = document.createElement("ui5-test-generic");
74
-
75
- destructionCallbacks.forEach(callback => {
76
- const original = el[callback];
77
- el[callback] = () => {
78
- calledCallbacks.push(callback);
79
- original.call(el);
80
- };
81
- });
82
-
83
- document.body.appendChild(el);
84
-
85
- await window["sap-ui-webcomponents-bundle"].renderFinished(); // Must wait, otherwise onExitDOM won't be called
86
-
87
- document.body.removeChild(el);
88
-
89
- await window["sap-ui-webcomponents-bundle"].renderFinished();
90
-
91
- done(calledCallbacks);
92
- });
93
-
94
- assert.strictEqual(res.length, 1, "Only 1 callback was called");
95
- assert.strictEqual(res[0], "onExitDOM", "onExitDOM called");
96
- });
97
-
98
- });
@@ -1,75 +0,0 @@
1
- const assert = require("chai").assert;
2
-
3
- describe("Metadata slot invalidateOnChildChange works", () => {
4
- before(async () => {
5
- await browser.url("http://localhost:9191/test-resources/pages/AllTestElements.html");
6
- });
7
-
8
- it("Tests that changing a monitored property of a child invalidates the parent", async () => {
9
-
10
- const res = await browser.executeAsync( async (done) => {
11
- const parent = document.getElementById("parent");
12
- const child = document.getElementById("child1");
13
-
14
- let parentInvalidated = false;
15
-
16
- parent.onInvalidation = () => {
17
- parentInvalidated = true;
18
- };
19
-
20
- child.prop1 = "a"; // child1(default slot) prop1 -> invalidates
21
-
22
- await window["sap-ui-webcomponents-bundle"].renderFinished();
23
-
24
- done(parentInvalidated);
25
- });
26
-
27
- assert.strictEqual(res, true, "Parent invalidated");
28
- });
29
-
30
- it("Tests that changing a non-monitored property of a child does not invalidate the parent", async () => {
31
-
32
- const res = await browser.executeAsync( async (done) => {
33
- const parent = document.getElementById("parent");
34
- const child = document.getElementById("child1");
35
-
36
- let parentInvalidated = false;
37
-
38
- parent.onInvalidation = () => {
39
- parentInvalidated = true;
40
- };
41
-
42
- child.prop2 = "b"; // child1(default slot) prop 2 -> does not
43
-
44
- await window["sap-ui-webcomponents-bundle"].renderFinished();
45
-
46
- done(parentInvalidated);
47
- });
48
-
49
- assert.strictEqual(res, false, "Parent not invalidated");
50
- });
51
-
52
- it("Tests that listening for all properties works", async () => {
53
-
54
- const res = await browser.executeAsync( async (done) => {
55
- const parent = document.getElementById("parent");
56
- const child = document.getElementById("child2");
57
-
58
- let parentInvalidatedCount = 0;
59
-
60
- parent.onInvalidation = () => {
61
- parentInvalidatedCount++;
62
- };
63
-
64
- child.prop1 = "c";
65
- child.prop2 = "c";
66
- child.prop3 = "c";
67
-
68
- await window["sap-ui-webcomponents-bundle"].renderFinished();
69
-
70
- done(parentInvalidatedCount);
71
- });
72
-
73
- assert.strictEqual(res, 3, "Parent invalidated 3 times");
74
- });
75
- });
@@ -1,42 +0,0 @@
1
- const assert = require("chai").assert;
2
-
3
- describe("Metadata can be extended", () => {
4
- before(async () => {
5
- await browser.url("http://localhost:9191/test-resources/pages/AllTestElements.html");
6
- });
7
-
8
- it("When extending metadata, both own and extended entities exist in the resulting metadata", async () => {
9
-
10
- const res = await browser.executeAsync(done => {
11
-
12
- const el = document.getElementById("genExt");
13
- const m = el.constructor.getMetadata();
14
-
15
- const ok = !!m.getProperties().strProp &&
16
- !!m.getProperties().extProp &&
17
- !!m.getSlots().default &&
18
- !!m.getSlots().extSlot;
19
-
20
- done(ok);
21
- });
22
-
23
- assert.strictEqual(res, true, "Metadata properly extended");
24
- });
25
-
26
- it("When extending metadata, property defaultValue can be modified", async () => {
27
-
28
- const res = await browser.executeAsync(done => {
29
-
30
- const el = document.getElementById("genExt");
31
- const m = el.constructor.getMetadata();
32
-
33
- const ok = !!m.getProperties().strProp &&
34
- m.getProperties().strProp.defaultValue === "Ext";
35
-
36
- done(ok);
37
- });
38
-
39
- assert.strictEqual(res, true, "Property defaultValue changed");
40
- });
41
-
42
- });
@@ -1,14 +0,0 @@
1
- const assert = require("chai").assert;
2
-
3
- describe("Properties can only have values, restricted to their types", () => {
4
- before(async () => {
5
- await browser.url("http://localhost:9191/test-resources/pages/AllTestElements.html");
6
- });
7
-
8
- it("String property enforced to string", async () => {
9
- const el = await browser.$("#gen");
10
- await el.setProperty("strProp", 5);
11
- assert.strictEqual(await el.getProperty("strProp"), "5", "String property is string");
12
- });
13
-
14
- });