@ui5/webcomponents-base 0.33.0 → 1.0.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/.eslintignore +2 -1
- package/CHANGELOG.md +34 -0
- package/README.md +26 -2
- package/bundle.esm.js +6 -2
- package/dist/CSP.js +59 -0
- package/dist/Device.js +5 -0
- package/dist/EventProvider.js +19 -25
- package/dist/FontFace.js +7 -95
- package/dist/InitialConfiguration.js +11 -7
- package/dist/Keys.js +9 -0
- package/dist/ManagedStyles.js +83 -0
- package/dist/Render.js +3 -1
- package/dist/StaticAreaItem.js +11 -9
- package/dist/SystemCSSVars.js +4 -25
- package/dist/UI5Element.js +43 -59
- package/dist/UI5ElementMetadata.js +9 -1
- package/dist/asset-registries/Icons.js +26 -8
- package/dist/asset-registries/Illustrations.js +10 -3
- package/dist/asset-registries/LocaleData.js +11 -2
- package/dist/assets-meta/IconCollectionsAlias.js +18 -0
- package/dist/config/Theme.js +14 -0
- package/dist/css/FontFace.css +45 -0
- package/dist/css/OverrideFontFace.css +32 -0
- package/dist/css/SystemCSSVars.css +17 -0
- package/dist/delegate/ItemNavigation.js +66 -0
- package/dist/generated/AssetParameters.js +1 -1
- package/dist/generated/css/FontFace.css.js +5 -0
- package/dist/generated/css/OverrideFontFace.css.js +5 -0
- package/dist/generated/css/SystemCSSVars.css.js +5 -0
- package/dist/i18nBundle.js +33 -2
- package/dist/renderer/LitRenderer.js +7 -4
- package/dist/renderer/directives/style-map.js +72 -0
- package/dist/resources/bundle.esm.js +19 -8
- package/dist/resources/bundle.esm.js.map +1 -1
- package/dist/sap/base/Log.js +2 -10
- package/dist/sap/base/assert.js +1 -5
- package/dist/test-resources/elements/WithStaticArea.js +2 -1
- package/dist/test-resources/pages/AllTestElements.html +3 -0
- package/dist/test-resources/pages/i18n.html +1 -3
- package/dist/test-resources/specs/ConfigurationChange.spec.js +9 -9
- package/dist/test-resources/specs/ConfigurationScript.spec.js +24 -24
- package/dist/test-resources/specs/ConfigurationURL.spec.js +33 -33
- package/dist/test-resources/specs/CustomTheme.spec.js +7 -7
- package/dist/test-resources/specs/EventProvider.spec.js +63 -0
- package/dist/test-resources/specs/StaticArea.spec.js +55 -13
- package/dist/test-resources/specs/Theming.spec.js +11 -11
- package/dist/test-resources/specs/UI5ElementInvalidation.js +29 -29
- package/dist/test-resources/specs/UI5ElementLifecycle.js +11 -11
- package/dist/test-resources/specs/UI5ElementListenForChildPropChanges.spec.js +11 -11
- package/dist/test-resources/specs/UI5ElementMetadataExt.js +8 -8
- package/dist/test-resources/specs/UI5ElementPropertyValidation.js +6 -6
- package/dist/test-resources/specs/UI5ElementPropsAndAttrs.spec.js +36 -36
- package/dist/test-resources/specs/UI5ElementShadowDOM.js +9 -9
- package/dist/test-resources/specs/UI5ElementSlots.js +9 -9
- package/dist/theming/CustomStyle.js +23 -3
- package/dist/theming/applyTheme.js +5 -8
- package/dist/theming/getEffectiveLinksHrefs.js +20 -0
- package/dist/theming/getStylesString.js +4 -2
- package/dist/theming/getThemeDesignerTheme.js +2 -1
- package/dist/theming/preloadLinks.js +23 -0
- package/dist/types/DataType.js +12 -0
- package/dist/types/Float.js +4 -0
- package/dist/types/Integer.js +4 -0
- package/dist/updateShadowRoot.js +8 -4
- package/dist/util/createLinkInHead.js +19 -0
- package/dist/util/encodeXML.js +35 -0
- package/dist/util/escapeRegex.js +10 -0
- package/dist/util/generateHighlightedMarkup.js +42 -0
- package/hash.txt +1 -1
- package/lib/generate-asset-parameters/index.js +0 -1
- package/lib/generate-styles/index.js +18 -0
- package/package-scripts.js +9 -6
- package/package.json +10 -12
- package/src/CSP.js +59 -0
- package/src/Device.js +5 -0
- package/src/EventProvider.js +19 -25
- package/src/FontFace.js +7 -95
- package/src/InitialConfiguration.js +11 -7
- package/src/Keys.js +9 -0
- package/src/ManagedStyles.js +83 -0
- package/src/Render.js +3 -1
- package/src/StaticAreaItem.js +11 -9
- package/src/SystemCSSVars.js +4 -25
- package/src/UI5Element.js +43 -59
- package/src/UI5ElementMetadata.js +9 -1
- package/src/asset-registries/Icons.js +26 -8
- package/src/asset-registries/Illustrations.js +10 -3
- package/src/asset-registries/LocaleData.js +11 -2
- package/src/assets-meta/IconCollectionsAlias.js +18 -0
- package/src/config/Theme.js +14 -0
- package/src/css/FontFace.css +45 -0
- package/src/css/OverrideFontFace.css +32 -0
- package/src/css/SystemCSSVars.css +17 -0
- package/src/delegate/ItemNavigation.js +66 -0
- package/src/i18nBundle.js +33 -2
- package/src/renderer/LitRenderer.js +7 -4
- package/src/renderer/directives/style-map.js +72 -0
- package/src/theming/CustomStyle.js +23 -3
- package/src/theming/applyTheme.js +5 -8
- package/src/theming/getEffectiveLinksHrefs.js +20 -0
- package/src/theming/getStylesString.js +4 -2
- package/src/theming/getThemeDesignerTheme.js +2 -1
- package/src/theming/preloadLinks.js +23 -0
- package/src/types/DataType.js +12 -0
- package/src/types/Float.js +4 -0
- package/src/types/Integer.js +4 -0
- package/src/updateShadowRoot.js +8 -4
- package/src/util/createLinkInHead.js +19 -0
- package/src/util/encodeXML.js +35 -0
- package/src/util/escapeRegex.js +10 -0
- package/src/util/generateHighlightedMarkup.js +42 -0
- package/dist/config/AssetsPath.js +0 -17
- package/dist/theming/createThemePropertiesStyleTag.js +0 -20
- package/src/config/AssetsPath.js +0 -17
- package/src/theming/createThemePropertiesStyleTag.js +0 -20
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
const assert = require("chai").assert;
|
|
2
2
|
|
|
3
3
|
describe("Invalidation works", () => {
|
|
4
|
-
before(() => {
|
|
5
|
-
browser.url("http://localhost:9191/test-resources/pages/AllTestElements.html");
|
|
4
|
+
before(async () => {
|
|
5
|
+
await browser.url("http://localhost:9191/test-resources/pages/AllTestElements.html");
|
|
6
6
|
});
|
|
7
7
|
|
|
8
|
-
it("Tests that changing a property invalidates", () => {
|
|
8
|
+
it("Tests that changing a property invalidates", async () => {
|
|
9
9
|
|
|
10
|
-
const res = browser.executeAsync( async (done) => {
|
|
10
|
+
const res = await browser.executeAsync( async (done) => {
|
|
11
11
|
|
|
12
12
|
const el = document.getElementById("gen");
|
|
13
13
|
|
|
@@ -23,15 +23,15 @@ describe("Invalidation works", () => {
|
|
|
23
23
|
|
|
24
24
|
await window["sap-ui-webcomponents-bundle"].renderFinished();
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
done(invalidations);
|
|
27
27
|
});
|
|
28
28
|
|
|
29
29
|
assert.strictEqual(res, 2, "Invalidated 2 times");
|
|
30
30
|
});
|
|
31
31
|
|
|
32
|
-
it("Tests that setting a property to the same value does not invalidate", () => {
|
|
32
|
+
it("Tests that setting a property to the same value does not invalidate", async () => {
|
|
33
33
|
|
|
34
|
-
const res = browser.executeAsync( async (done) => {
|
|
34
|
+
const res = await browser.executeAsync( async (done) => {
|
|
35
35
|
const text = "some value";
|
|
36
36
|
|
|
37
37
|
const el = document.getElementById("gen");
|
|
@@ -48,15 +48,15 @@ describe("Invalidation works", () => {
|
|
|
48
48
|
|
|
49
49
|
await window["sap-ui-webcomponents-bundle"].renderFinished();
|
|
50
50
|
|
|
51
|
-
|
|
51
|
+
done(invalidations);
|
|
52
52
|
});
|
|
53
53
|
|
|
54
54
|
assert.strictEqual(res, 0, "Not invalidated");
|
|
55
55
|
});
|
|
56
56
|
|
|
57
|
-
it("Tests that setting a property of type Object always invalidates", () => {
|
|
57
|
+
it("Tests that setting a property of type Object always invalidates", async () => {
|
|
58
58
|
|
|
59
|
-
const res = browser.executeAsync( async (done) => {
|
|
59
|
+
const res = await browser.executeAsync( async (done) => {
|
|
60
60
|
const obj = {};
|
|
61
61
|
const otherObj = {};
|
|
62
62
|
|
|
@@ -74,15 +74,15 @@ describe("Invalidation works", () => {
|
|
|
74
74
|
|
|
75
75
|
await window["sap-ui-webcomponents-bundle"].renderFinished();
|
|
76
76
|
|
|
77
|
-
|
|
77
|
+
done(invalidations);
|
|
78
78
|
});
|
|
79
79
|
|
|
80
80
|
assert.strictEqual(res, 1, "Invalidated");
|
|
81
81
|
});
|
|
82
82
|
|
|
83
|
-
it("Tests that setting an array property always invalidates", () => {
|
|
83
|
+
it("Tests that setting an array property always invalidates", async () => {
|
|
84
84
|
|
|
85
|
-
const res = browser.executeAsync( async (done) => {
|
|
85
|
+
const res = await browser.executeAsync( async (done) => {
|
|
86
86
|
const arr = [];
|
|
87
87
|
const otherArr = [];
|
|
88
88
|
|
|
@@ -100,15 +100,15 @@ describe("Invalidation works", () => {
|
|
|
100
100
|
|
|
101
101
|
await window["sap-ui-webcomponents-bundle"].renderFinished();
|
|
102
102
|
|
|
103
|
-
|
|
103
|
+
done(invalidations);
|
|
104
104
|
});
|
|
105
105
|
|
|
106
106
|
assert.strictEqual(res, 1, "Invalidated");
|
|
107
107
|
});
|
|
108
108
|
|
|
109
|
-
it("Tests that adding a child invalidates", () => {
|
|
109
|
+
it("Tests that adding a child invalidates", async () => {
|
|
110
110
|
|
|
111
|
-
const res = browser.executeAsync( async (done) => {
|
|
111
|
+
const res = await browser.executeAsync( async (done) => {
|
|
112
112
|
|
|
113
113
|
const el = document.getElementById("gen");
|
|
114
114
|
|
|
@@ -124,15 +124,15 @@ describe("Invalidation works", () => {
|
|
|
124
124
|
|
|
125
125
|
await window["sap-ui-webcomponents-bundle"].renderFinished();
|
|
126
126
|
|
|
127
|
-
|
|
127
|
+
done(invalidated);
|
|
128
128
|
});
|
|
129
129
|
|
|
130
130
|
assert.strictEqual(res, true, "Invalidated");
|
|
131
131
|
});
|
|
132
132
|
|
|
133
|
-
it("Tests that removing a child invalidates", () => {
|
|
133
|
+
it("Tests that removing a child invalidates", async () => {
|
|
134
134
|
|
|
135
|
-
const res = browser.executeAsync( async (done) => {
|
|
135
|
+
const res = await browser.executeAsync( async (done) => {
|
|
136
136
|
|
|
137
137
|
const el = document.getElementById("gen");
|
|
138
138
|
const div = document.createElement("div");
|
|
@@ -150,15 +150,15 @@ describe("Invalidation works", () => {
|
|
|
150
150
|
|
|
151
151
|
await window["sap-ui-webcomponents-bundle"].renderFinished();
|
|
152
152
|
|
|
153
|
-
|
|
153
|
+
done(invalidated);
|
|
154
154
|
});
|
|
155
155
|
|
|
156
156
|
assert.strictEqual(res, true, "Invalidated");
|
|
157
157
|
});
|
|
158
158
|
|
|
159
|
-
it("Tests that modifying textContent invalidates", () => {
|
|
159
|
+
it("Tests that modifying textContent invalidates", async () => {
|
|
160
160
|
|
|
161
|
-
const res = browser.executeAsync( async (done) => {
|
|
161
|
+
const res = await browser.executeAsync( async (done) => {
|
|
162
162
|
|
|
163
163
|
const el = document.getElementById("gen");
|
|
164
164
|
el.textContent = "test";
|
|
@@ -175,15 +175,15 @@ describe("Invalidation works", () => {
|
|
|
175
175
|
|
|
176
176
|
await window["sap-ui-webcomponents-bundle"].renderFinished();
|
|
177
177
|
|
|
178
|
-
|
|
178
|
+
done(invalidated);
|
|
179
179
|
});
|
|
180
180
|
|
|
181
181
|
assert.strictEqual(res, true, "Invalidated");
|
|
182
182
|
});
|
|
183
183
|
|
|
184
|
-
it("Tests that modifying nodeValue invalidates", () => {
|
|
184
|
+
it("Tests that modifying nodeValue invalidates", async () => {
|
|
185
185
|
|
|
186
|
-
const res = browser.executeAsync( async (done) => {
|
|
186
|
+
const res = await browser.executeAsync( async (done) => {
|
|
187
187
|
|
|
188
188
|
const el = document.getElementById("gen");
|
|
189
189
|
el.textContent = "test";
|
|
@@ -200,15 +200,15 @@ describe("Invalidation works", () => {
|
|
|
200
200
|
|
|
201
201
|
await window["sap-ui-webcomponents-bundle"].renderFinished();
|
|
202
202
|
|
|
203
|
-
|
|
203
|
+
done(invalidated);
|
|
204
204
|
});
|
|
205
205
|
|
|
206
206
|
assert.strictEqual(res, true, "Invalidated");
|
|
207
207
|
});
|
|
208
208
|
|
|
209
|
-
it("Tests that multiple invalidations result in a single rendering", () => {
|
|
209
|
+
it("Tests that multiple invalidations result in a single rendering", async () => {
|
|
210
210
|
|
|
211
|
-
const res = browser.executeAsync( async (done) => {
|
|
211
|
+
const res = await browser.executeAsync( async (done) => {
|
|
212
212
|
|
|
213
213
|
const el = document.getElementById("gen");
|
|
214
214
|
|
|
@@ -232,7 +232,7 @@ describe("Invalidation works", () => {
|
|
|
232
232
|
|
|
233
233
|
await window["sap-ui-webcomponents-bundle"].renderFinished();
|
|
234
234
|
|
|
235
|
-
|
|
235
|
+
done(operations);
|
|
236
236
|
});
|
|
237
237
|
|
|
238
238
|
assert.strictEqual(res.invalidation, 2, "Invalidated 2 times");
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
const assert = require("chai").assert;
|
|
2
2
|
|
|
3
3
|
describe("Lifecycle works", () => {
|
|
4
|
-
before(() => {
|
|
5
|
-
browser.url("http://localhost:9191/test-resources/pages/AllTestElements.html");
|
|
4
|
+
before(async () => {
|
|
5
|
+
await browser.url("http://localhost:9191/test-resources/pages/AllTestElements.html");
|
|
6
6
|
});
|
|
7
7
|
|
|
8
|
-
it("Tests element creation callbacks", () => {
|
|
8
|
+
it("Tests element creation callbacks", async () => {
|
|
9
9
|
|
|
10
|
-
const res = browser.executeAsync( async (done) => {
|
|
10
|
+
const res = await browser.executeAsync( async (done) => {
|
|
11
11
|
const creationCallbacks = ["onBeforeRendering", "onAfterRendering", "onEnterDOM"];
|
|
12
12
|
const calledCallbacks = [];
|
|
13
13
|
|
|
@@ -24,7 +24,7 @@ describe("Lifecycle works", () => {
|
|
|
24
24
|
document.body.appendChild(el);
|
|
25
25
|
await window["sap-ui-webcomponents-bundle"].renderFinished();
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
done(calledCallbacks);
|
|
28
28
|
});
|
|
29
29
|
|
|
30
30
|
assert.strictEqual(res.length, 3, "All 3 callbacks called");
|
|
@@ -33,9 +33,9 @@ describe("Lifecycle works", () => {
|
|
|
33
33
|
assert.strictEqual(res[2], "onEnterDOM", "onEnterDOM called third");
|
|
34
34
|
});
|
|
35
35
|
|
|
36
|
-
it("Tests element invalidation callbacks", () => {
|
|
36
|
+
it("Tests element invalidation callbacks", async () => {
|
|
37
37
|
|
|
38
|
-
const res = browser.executeAsync( async (done) => {
|
|
38
|
+
const res = await browser.executeAsync( async (done) => {
|
|
39
39
|
const invalidationCallbacks = ["onBeforeRendering", "onAfterRendering"];
|
|
40
40
|
const calledCallbacks = [];
|
|
41
41
|
|
|
@@ -56,7 +56,7 @@ describe("Lifecycle works", () => {
|
|
|
56
56
|
|
|
57
57
|
await window["sap-ui-webcomponents-bundle"].renderFinished();
|
|
58
58
|
|
|
59
|
-
|
|
59
|
+
done(calledCallbacks);
|
|
60
60
|
});
|
|
61
61
|
|
|
62
62
|
assert.strictEqual(res.length, 2, "All 2 callbacks called");
|
|
@@ -64,9 +64,9 @@ describe("Lifecycle works", () => {
|
|
|
64
64
|
assert.strictEqual(res[1], "onAfterRendering", "onAfterRendering called second");
|
|
65
65
|
});
|
|
66
66
|
|
|
67
|
-
it("Tests element destruction callback", () => {
|
|
67
|
+
it("Tests element destruction callback", async () => {
|
|
68
68
|
|
|
69
|
-
const res = browser.executeAsync( async (done) => {
|
|
69
|
+
const res = await browser.executeAsync( async (done) => {
|
|
70
70
|
const destructionCallbacks = ["onExitDOM"];
|
|
71
71
|
const calledCallbacks = [];
|
|
72
72
|
|
|
@@ -88,7 +88,7 @@ describe("Lifecycle works", () => {
|
|
|
88
88
|
|
|
89
89
|
await window["sap-ui-webcomponents-bundle"].renderFinished();
|
|
90
90
|
|
|
91
|
-
|
|
91
|
+
done(calledCallbacks);
|
|
92
92
|
});
|
|
93
93
|
|
|
94
94
|
assert.strictEqual(res.length, 1, "Only 1 callback was called");
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
const assert = require("chai").assert;
|
|
2
2
|
|
|
3
3
|
describe("Metadata slot invalidateOnChildChange works", () => {
|
|
4
|
-
before(() => {
|
|
5
|
-
browser.url("http://localhost:9191/test-resources/pages/AllTestElements.html");
|
|
4
|
+
before(async () => {
|
|
5
|
+
await browser.url("http://localhost:9191/test-resources/pages/AllTestElements.html");
|
|
6
6
|
});
|
|
7
7
|
|
|
8
|
-
it("Tests that changing a monitored property of a child invalidates the parent", () => {
|
|
8
|
+
it("Tests that changing a monitored property of a child invalidates the parent", async () => {
|
|
9
9
|
|
|
10
|
-
const res = browser.executeAsync( async (done) => {
|
|
10
|
+
const res = await browser.executeAsync( async (done) => {
|
|
11
11
|
const parent = document.getElementById("parent");
|
|
12
12
|
const child = document.getElementById("child1");
|
|
13
13
|
|
|
@@ -21,15 +21,15 @@ describe("Metadata slot invalidateOnChildChange works", () => {
|
|
|
21
21
|
|
|
22
22
|
await window["sap-ui-webcomponents-bundle"].renderFinished();
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
done(parentInvalidated);
|
|
25
25
|
});
|
|
26
26
|
|
|
27
27
|
assert.strictEqual(res, true, "Parent invalidated");
|
|
28
28
|
});
|
|
29
29
|
|
|
30
|
-
it("Tests that changing a non-monitored property of a child does not invalidate the parent", () => {
|
|
30
|
+
it("Tests that changing a non-monitored property of a child does not invalidate the parent", async () => {
|
|
31
31
|
|
|
32
|
-
const res = browser.executeAsync( async (done) => {
|
|
32
|
+
const res = await browser.executeAsync( async (done) => {
|
|
33
33
|
const parent = document.getElementById("parent");
|
|
34
34
|
const child = document.getElementById("child1");
|
|
35
35
|
|
|
@@ -43,15 +43,15 @@ describe("Metadata slot invalidateOnChildChange works", () => {
|
|
|
43
43
|
|
|
44
44
|
await window["sap-ui-webcomponents-bundle"].renderFinished();
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
done(parentInvalidated);
|
|
47
47
|
});
|
|
48
48
|
|
|
49
49
|
assert.strictEqual(res, false, "Parent not invalidated");
|
|
50
50
|
});
|
|
51
51
|
|
|
52
|
-
it("Tests that listening for all properties works", () => {
|
|
52
|
+
it("Tests that listening for all properties works", async () => {
|
|
53
53
|
|
|
54
|
-
const res = browser.executeAsync( async (done) => {
|
|
54
|
+
const res = await browser.executeAsync( async (done) => {
|
|
55
55
|
const parent = document.getElementById("parent");
|
|
56
56
|
const child = document.getElementById("child2");
|
|
57
57
|
|
|
@@ -67,7 +67,7 @@ describe("Metadata slot invalidateOnChildChange works", () => {
|
|
|
67
67
|
|
|
68
68
|
await window["sap-ui-webcomponents-bundle"].renderFinished();
|
|
69
69
|
|
|
70
|
-
|
|
70
|
+
done(parentInvalidatedCount);
|
|
71
71
|
});
|
|
72
72
|
|
|
73
73
|
assert.strictEqual(res, 3, "Parent invalidated 3 times");
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
const assert = require("chai").assert;
|
|
2
2
|
|
|
3
3
|
describe("Metadata can be extended", () => {
|
|
4
|
-
before(() => {
|
|
5
|
-
browser.url("http://localhost:9191/test-resources/pages/AllTestElements.html");
|
|
4
|
+
before(async () => {
|
|
5
|
+
await browser.url("http://localhost:9191/test-resources/pages/AllTestElements.html");
|
|
6
6
|
});
|
|
7
7
|
|
|
8
|
-
it("When extending metadata, both own and extended entities exist in the resulting metadata", () => {
|
|
8
|
+
it("When extending metadata, both own and extended entities exist in the resulting metadata", async () => {
|
|
9
9
|
|
|
10
|
-
const res = browser.
|
|
10
|
+
const res = await browser.executeAsync(done => {
|
|
11
11
|
|
|
12
12
|
const el = document.getElementById("genExt");
|
|
13
13
|
const m = el.constructor.getMetadata();
|
|
@@ -17,15 +17,15 @@ describe("Metadata can be extended", () => {
|
|
|
17
17
|
!!m.getSlots().default &&
|
|
18
18
|
!!m.getSlots().extSlot;
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
done(ok);
|
|
21
21
|
});
|
|
22
22
|
|
|
23
23
|
assert.strictEqual(res, true, "Metadata properly extended");
|
|
24
24
|
});
|
|
25
25
|
|
|
26
|
-
it("When extending metadata, property defaultValue can be modified", () => {
|
|
26
|
+
it("When extending metadata, property defaultValue can be modified", async () => {
|
|
27
27
|
|
|
28
|
-
const res = browser.
|
|
28
|
+
const res = await browser.executeAsync(done => {
|
|
29
29
|
|
|
30
30
|
const el = document.getElementById("genExt");
|
|
31
31
|
const m = el.constructor.getMetadata();
|
|
@@ -33,7 +33,7 @@ describe("Metadata can be extended", () => {
|
|
|
33
33
|
const ok = !!m.getProperties().strProp &&
|
|
34
34
|
m.getProperties().strProp.defaultValue === "Ext";
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
done(ok);
|
|
37
37
|
});
|
|
38
38
|
|
|
39
39
|
assert.strictEqual(res, true, "Property defaultValue changed");
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
const assert = require("chai").assert;
|
|
2
2
|
|
|
3
3
|
describe("Properties can only have values, restricted to their types", () => {
|
|
4
|
-
before(() => {
|
|
5
|
-
browser.url("http://localhost:9191/test-resources/pages/AllTestElements.html");
|
|
4
|
+
before(async () => {
|
|
5
|
+
await browser.url("http://localhost:9191/test-resources/pages/AllTestElements.html");
|
|
6
6
|
});
|
|
7
7
|
|
|
8
|
-
it("String property enforced to string", () => {
|
|
9
|
-
const el = browser.$("#gen");
|
|
10
|
-
el.setProperty("strProp", 5);
|
|
11
|
-
assert.strictEqual(el.getProperty("strProp"), "5", "String property is string");
|
|
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
12
|
});
|
|
13
13
|
|
|
14
14
|
});
|
|
@@ -1,67 +1,67 @@
|
|
|
1
1
|
const assert = require("chai").assert;
|
|
2
2
|
|
|
3
3
|
describe("Properties and attributes convert to each other", () => {
|
|
4
|
-
before(() => {
|
|
5
|
-
browser.url("http://localhost:9191/test-resources/pages/AllTestElements.html");
|
|
4
|
+
before(async () => {
|
|
5
|
+
await browser.url("http://localhost:9191/test-resources/pages/AllTestElements.html");
|
|
6
6
|
});
|
|
7
7
|
|
|
8
|
-
it("Tests that properties with default values are initialized with the default value", () => {
|
|
9
|
-
const el = browser.$("#gen");
|
|
8
|
+
it("Tests that properties with default values are initialized with the default value", async () => {
|
|
9
|
+
const el = await browser.$("#gen");
|
|
10
10
|
|
|
11
|
-
assert.strictEqual(el.getProperty("defaultValueProp"), "Hello", "defaultValueProp is properly initialized");
|
|
11
|
+
assert.strictEqual(await el.getProperty("defaultValueProp"), "Hello", "defaultValueProp is properly initialized");
|
|
12
12
|
});
|
|
13
13
|
|
|
14
|
-
it("Tests that prop-attr conversion works for string properties", () => {
|
|
15
|
-
const el = browser.$("#gen");
|
|
14
|
+
it("Tests that prop-attr conversion works for string properties", async () => {
|
|
15
|
+
const el = await browser.$("#gen");
|
|
16
16
|
|
|
17
|
-
el.setProperty("strProp", "test1");
|
|
18
|
-
assert.strictEqual(el.getAttribute("str-prop"), "test1", "Attribute affected by property change");
|
|
17
|
+
await el.setProperty("strProp", "test1");
|
|
18
|
+
assert.strictEqual(await el.getAttribute("str-prop"), "test1", "Attribute affected by property change");
|
|
19
19
|
|
|
20
|
-
el.setAttribute("str-prop", "test2");
|
|
21
|
-
assert.strictEqual(el.getProperty("strProp"), "test2", "Property affected by attribute change");
|
|
20
|
+
await el.setAttribute("str-prop", "test2");
|
|
21
|
+
assert.strictEqual(await el.getProperty("strProp"), "test2", "Property affected by attribute change");
|
|
22
22
|
});
|
|
23
23
|
|
|
24
|
-
it("Tests that prop-attr conversion works for boolean properties", () => {
|
|
25
|
-
const el = browser.$("#gen");
|
|
24
|
+
it("Tests that prop-attr conversion works for boolean properties", async () => {
|
|
25
|
+
const el = await browser.$("#gen");
|
|
26
26
|
|
|
27
|
-
el.setProperty("boolProp", true);
|
|
28
|
-
assert.strictEqual(el.getAttribute("bool-prop"), "", "Attribute affected by property change");
|
|
27
|
+
await el.setProperty("boolProp", true);
|
|
28
|
+
assert.strictEqual(await el.getAttribute("bool-prop"), "", "Attribute affected by property change");
|
|
29
29
|
|
|
30
|
-
el.setProperty("boolProp", false);
|
|
31
|
-
assert.strictEqual(el.getAttribute("bool-prop"), null, "Attribute affected by property change");
|
|
30
|
+
await el.setProperty("boolProp", false);
|
|
31
|
+
assert.strictEqual(await el.getAttribute("bool-prop"), null, "Attribute affected by property change");
|
|
32
32
|
|
|
33
|
-
el.setAttribute("bool-prop", "");
|
|
34
|
-
assert.strictEqual(el.getProperty("boolProp"), true, "Property affected by attribute change");
|
|
33
|
+
await el.setAttribute("bool-prop", "");
|
|
34
|
+
assert.strictEqual(await el.getProperty("boolProp"), true, "Property affected by attribute change");
|
|
35
35
|
|
|
36
|
-
el.removeAttribute("bool-prop");
|
|
37
|
-
assert.strictEqual(el.getProperty("boolProp"), false, "Property affected by attribute change");
|
|
36
|
+
await el.removeAttribute("bool-prop");
|
|
37
|
+
assert.strictEqual(await el.getProperty("boolProp"), false, "Property affected by attribute change");
|
|
38
38
|
});
|
|
39
39
|
|
|
40
|
-
it("Tests that object properties have no attributes", () => {
|
|
41
|
-
const el = browser.$("#gen");
|
|
40
|
+
it("Tests that object properties have no attributes", async () => {
|
|
41
|
+
const el = await browser.$("#gen");
|
|
42
42
|
|
|
43
|
-
el.setProperty("objectProp", {});
|
|
44
|
-
assert.strictEqual(el.getAttribute("object-prop"), null, "Attribute not there");
|
|
43
|
+
await el.setProperty("objectProp", {});
|
|
44
|
+
assert.strictEqual(await el.getAttribute("object-prop"), null, "Attribute not there");
|
|
45
45
|
});
|
|
46
46
|
|
|
47
|
-
it("Tests that array properties have no attributes", () => {
|
|
48
|
-
const el = browser.$("#gen");
|
|
47
|
+
it("Tests that array properties have no attributes", async () => {
|
|
48
|
+
const el = await browser.$("#gen");
|
|
49
49
|
|
|
50
|
-
el.setProperty("multiProp", ["a", "b"]);
|
|
51
|
-
assert.strictEqual(el.getAttribute("multi-prop"), null, "Attribute not there");
|
|
50
|
+
await el.setProperty("multiProp", ["a", "b"]);
|
|
51
|
+
assert.strictEqual(await el.getAttribute("multi-prop"), null, "Attribute not there");
|
|
52
52
|
});
|
|
53
53
|
|
|
54
|
-
it("Tests that noAttribute properties have no attributes", () => {
|
|
55
|
-
const el = browser.$("#gen");
|
|
54
|
+
it("Tests that noAttribute properties have no attributes", async () => {
|
|
55
|
+
const el = await browser.$("#gen");
|
|
56
56
|
|
|
57
|
-
el.setProperty("noAttributeProp", "some value");
|
|
58
|
-
assert.strictEqual(el.getAttribute("no-attribute-prop"), null, "Attribute not there");
|
|
57
|
+
await el.setProperty("noAttributeProp", "some value");
|
|
58
|
+
assert.strictEqual(await el.getAttribute("no-attribute-prop"), null, "Attribute not there");
|
|
59
59
|
});
|
|
60
60
|
|
|
61
|
-
it("Tests that properties with default values do not automatically set attributes", () => {
|
|
62
|
-
const el = browser.$("#gen");
|
|
61
|
+
it("Tests that properties with default values do not automatically set attributes", async () => {
|
|
62
|
+
const el = await browser.$("#gen");
|
|
63
63
|
|
|
64
|
-
assert.strictEqual(el.getAttribute("default-value-prop"), null, "Attribute not there for defaultValueProp");
|
|
64
|
+
assert.strictEqual(await el.getAttribute("default-value-prop"), null, "Attribute not there for defaultValueProp");
|
|
65
65
|
});
|
|
66
66
|
|
|
67
67
|
});
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
const assert = require("chai").assert;
|
|
2
2
|
|
|
3
3
|
describe("The framework can define web components", () => {
|
|
4
|
-
before(() => {
|
|
5
|
-
browser.url("http://localhost:9191/test-resources/pages/AllTestElements.html");
|
|
4
|
+
before(async () => {
|
|
5
|
+
await browser.url("http://localhost:9191/test-resources/pages/AllTestElements.html");
|
|
6
6
|
});
|
|
7
7
|
|
|
8
|
-
it("Tests that element's Shadow DOM is rendered if it has a template", () => {
|
|
9
|
-
const res = browser.
|
|
10
|
-
|
|
8
|
+
it("Tests that element's Shadow DOM is rendered if it has a template", async () => {
|
|
9
|
+
const res = await browser.executeAsync(done => {
|
|
10
|
+
done(document.getElementById("gen").shadowRoot);
|
|
11
11
|
});
|
|
12
12
|
|
|
13
13
|
assert.strictEqual(!!res, true, "Shadow root created");
|
|
14
|
-
assert.strictEqual(browser.$("#gen").shadow$("div>p").isExisting(), true, "Shadow root content created");
|
|
14
|
+
assert.strictEqual(await browser.$("#gen").shadow$("div>p").isExisting(), true, "Shadow root content created");
|
|
15
15
|
});
|
|
16
16
|
|
|
17
|
-
it("Tests that element's Shadow DOM is not rendered if it has no template", () => {
|
|
18
|
-
const res = browser.
|
|
19
|
-
|
|
17
|
+
it("Tests that element's Shadow DOM is not rendered if it has no template", async () => {
|
|
18
|
+
const res = await browser.executeAsync(done => {
|
|
19
|
+
done(document.getElementById("noShadow").shadowRoot);
|
|
20
20
|
});
|
|
21
21
|
|
|
22
22
|
assert.strictEqual(!!res, false, "Shadow root not created");
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
const assert = require("chai").assert;
|
|
2
2
|
|
|
3
3
|
describe("Slots work properly", () => {
|
|
4
|
-
before(() => {
|
|
5
|
-
browser.url("http://localhost:9191/test-resources/pages/AllTestElements.html");
|
|
4
|
+
before(async () => {
|
|
5
|
+
await browser.url("http://localhost:9191/test-resources/pages/AllTestElements.html");
|
|
6
6
|
});
|
|
7
7
|
|
|
8
|
-
it("Tests that properties exist on the element for each slot", () => {
|
|
9
|
-
const res = browser.
|
|
8
|
+
it("Tests that properties exist on the element for each slot", async () => {
|
|
9
|
+
const res = await browser.executeAsync(done => {
|
|
10
10
|
const expectedValues = {};
|
|
11
11
|
|
|
12
12
|
const el = document.getElementById("withContent");
|
|
@@ -17,7 +17,7 @@ describe("Slots work properly", () => {
|
|
|
17
17
|
expectedValues.items = el.items.length === 2;
|
|
18
18
|
expectedValues.named = el.named === undefined;
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
done(expectedValues);
|
|
21
21
|
});
|
|
22
22
|
|
|
23
23
|
assert.strictEqual(res.default, true, "There are elements in the default property");
|
|
@@ -27,10 +27,10 @@ describe("Slots work properly", () => {
|
|
|
27
27
|
assert.strictEqual(res.named, true, "There is no named property as propertyName changed it to items");
|
|
28
28
|
});
|
|
29
29
|
|
|
30
|
-
it("Tests that individualSlots modifies the slot property of slotted children", () => {
|
|
31
|
-
assert.strictEqual(browser.$$("#withContent>[slot=individual]").length, 0, "There are no children with slot=individual");
|
|
32
|
-
assert.strictEqual(browser.$$("#withContent>[slot=individual-1]").length, 1, "The slot of the first child became individual-1");
|
|
33
|
-
assert.strictEqual(browser.$$("#withContent>[slot=individual-2]").length, 1, "The slot of the second child became individual-2");
|
|
30
|
+
it("Tests that individualSlots modifies the slot property of slotted children", async () => {
|
|
31
|
+
assert.strictEqual((await browser.$$("#withContent>[slot=individual]")).length, 0, "There are no children with slot=individual");
|
|
32
|
+
assert.strictEqual((await browser.$$("#withContent>[slot=individual-1]")).length, 1, "The slot of the first child became individual-1");
|
|
33
|
+
assert.strictEqual((await browser.$$("#withContent>[slot=individual-2]")).length, 1, "The slot of the second child became individual-2");
|
|
34
34
|
});
|
|
35
35
|
|
|
36
36
|
});
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { reRenderAllUI5Elements } from "../Render.js";
|
|
2
|
+
import getSharedResource from "../getSharedResource.js";
|
|
2
3
|
import EventProvider from "../EventProvider.js";
|
|
3
4
|
|
|
4
|
-
const eventProvider = new EventProvider();
|
|
5
|
+
const eventProvider = getSharedResource("CustomStyle.eventProvider", new EventProvider());
|
|
5
6
|
const CUSTOM_CSS_CHANGE = "CustomCSSChange";
|
|
6
7
|
|
|
7
8
|
const attachCustomCSSChange = listener => {
|
|
@@ -16,14 +17,33 @@ const fireCustomCSSChange = tag => {
|
|
|
16
17
|
return eventProvider.fireEvent(CUSTOM_CSS_CHANGE, tag);
|
|
17
18
|
};
|
|
18
19
|
|
|
19
|
-
const customCSSFor = {};
|
|
20
|
+
const customCSSFor = getSharedResource("CustomStyle.customCSSFor", {});
|
|
21
|
+
|
|
22
|
+
// Listen to the eventProvider, in case other copies of this CustomStyle module fire this
|
|
23
|
+
// event, and this copy would therefore need to reRender the ui5 webcomponents; but
|
|
24
|
+
// don't reRender if it was this copy that fired the event to begin with.
|
|
25
|
+
let skipRerender;
|
|
26
|
+
attachCustomCSSChange(tag => {
|
|
27
|
+
if (!skipRerender) {
|
|
28
|
+
reRenderAllUI5Elements({ tag });
|
|
29
|
+
}
|
|
30
|
+
});
|
|
20
31
|
|
|
21
32
|
const addCustomCSS = (tag, css) => {
|
|
22
33
|
if (!customCSSFor[tag]) {
|
|
23
34
|
customCSSFor[tag] = [];
|
|
24
35
|
}
|
|
25
36
|
customCSSFor[tag].push(css);
|
|
26
|
-
|
|
37
|
+
|
|
38
|
+
skipRerender = true;
|
|
39
|
+
try {
|
|
40
|
+
// The event is fired and the attached event listeners are all called synchronously
|
|
41
|
+
// The skipRerender flag will be used to avoid calling reRenderAllUI5Elements twice when it is this copy
|
|
42
|
+
// of CustomStyle.js which is firing the `CustomCSSChange` event.
|
|
43
|
+
fireCustomCSSChange(tag);
|
|
44
|
+
} finally {
|
|
45
|
+
skipRerender = false;
|
|
46
|
+
}
|
|
27
47
|
|
|
28
48
|
return reRenderAllUI5Elements({ tag });
|
|
29
49
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { getThemeProperties, getRegisteredPackages, isThemeRegistered } from "../asset-registries/Themes.js";
|
|
2
|
-
import
|
|
2
|
+
import { removeStyle, createOrUpdateStyle } from "../ManagedStyles.js";
|
|
3
3
|
import getThemeDesignerTheme from "./getThemeDesignerTheme.js";
|
|
4
4
|
import { fireThemeLoaded } from "./ThemeLoaded.js";
|
|
5
5
|
import { getFeature } from "../FeaturesRegistry.js";
|
|
6
6
|
|
|
7
|
-
const BASE_THEME_PACKAGE = "@ui5/webcomponents-
|
|
7
|
+
const BASE_THEME_PACKAGE = "@ui5/webcomponents-theming";
|
|
8
8
|
|
|
9
9
|
const isThemeBaseRegistered = () => {
|
|
10
10
|
const registeredPackages = getRegisteredPackages();
|
|
@@ -17,14 +17,11 @@ const loadThemeBase = async theme => {
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
const cssText = await getThemeProperties(BASE_THEME_PACKAGE, theme);
|
|
20
|
-
|
|
20
|
+
createOrUpdateStyle(cssText, "data-ui5-theme-properties", BASE_THEME_PACKAGE);
|
|
21
21
|
};
|
|
22
22
|
|
|
23
23
|
const deleteThemeBase = () => {
|
|
24
|
-
|
|
25
|
-
if (styleElement) {
|
|
26
|
-
styleElement.parentElement.removeChild(styleElement);
|
|
27
|
-
}
|
|
24
|
+
removeStyle("data-ui5-theme-properties", BASE_THEME_PACKAGE);
|
|
28
25
|
};
|
|
29
26
|
|
|
30
27
|
const loadComponentPackages = async theme => {
|
|
@@ -35,7 +32,7 @@ const loadComponentPackages = async theme => {
|
|
|
35
32
|
}
|
|
36
33
|
|
|
37
34
|
const cssText = await getThemeProperties(packageName, theme);
|
|
38
|
-
|
|
35
|
+
createOrUpdateStyle(cssText, "data-ui5-theme-properties", packageName);
|
|
39
36
|
});
|
|
40
37
|
};
|
|
41
38
|
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { getUrl } from "../CSP.js";
|
|
2
|
+
|
|
3
|
+
const flatten = arr => {
|
|
4
|
+
return arr.reduce((acc, val) => acc.concat(Array.isArray(val) ? flatten(val) : val), []);
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
const getEffectiveLinksHrefs = (ElementClass, forStaticArea = false) => {
|
|
8
|
+
let stylesData = ElementClass[forStaticArea ? "staticAreaStyles" : "styles"];
|
|
9
|
+
if (!stylesData) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
if (!Array.isArray(stylesData)) {
|
|
14
|
+
stylesData = [stylesData];
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
return flatten(stylesData).filter(data => !!data).map(data => getUrl(data.packageName, data.fileName));
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export default getEffectiveLinksHrefs;
|