@ui5/webcomponents-base 0.0.0-b4cbc43ba → 0.0.0-b93c2a321

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 (212) hide show
  1. package/.eslintignore +3 -0
  2. package/CHANGELOG.md +214 -0
  3. package/README.md +26 -2
  4. package/bundle.esm.js +10 -7
  5. package/dist/AssetRegistry.js +8 -9
  6. package/dist/Boot.js +17 -6
  7. package/dist/CSP.js +59 -0
  8. package/dist/CustomElementsRegistry.js +60 -4
  9. package/dist/CustomElementsScope.js +20 -98
  10. package/dist/CustomElementsScopeUtils.js +108 -0
  11. package/dist/DOMObserver.js +6 -2
  12. package/dist/Device.js +69 -776
  13. package/dist/EventProvider.js +19 -25
  14. package/dist/FeaturesRegistry.js +4 -1
  15. package/dist/FontFace.js +7 -95
  16. package/dist/InitialConfiguration.js +37 -21
  17. package/dist/Keys.js +74 -0
  18. package/dist/ManagedStyles.js +83 -0
  19. package/dist/MediaRange.js +109 -0
  20. package/dist/{util/parseProperties.js → PropertiesFileFormat.js} +6 -0
  21. package/dist/Render.js +3 -2
  22. package/dist/Runtimes.js +107 -0
  23. package/dist/StaticArea.js +3 -0
  24. package/dist/StaticAreaItem.js +31 -10
  25. package/dist/SystemCSSVars.js +4 -25
  26. package/dist/UI5Element.js +66 -65
  27. package/dist/UI5ElementMetadata.js +18 -2
  28. package/dist/asset-registries/Icons.js +117 -14
  29. package/dist/asset-registries/Illustrations.js +30 -0
  30. package/dist/asset-registries/LocaleData.js +97 -68
  31. package/dist/asset-registries/Themes.js +23 -33
  32. package/dist/asset-registries/i18n.js +61 -50
  33. package/dist/assets-meta/IconCollectionsAlias.js +18 -0
  34. package/dist/config/Icons.js +52 -0
  35. package/dist/config/Language.js +15 -15
  36. package/dist/config/Theme.js +25 -0
  37. package/dist/css/BusyIndicator.css +76 -0
  38. package/dist/css/FontFace.css +75 -0
  39. package/dist/css/OverrideFontFace.css +32 -0
  40. package/dist/css/SystemCSSVars.css +17 -0
  41. package/dist/delegate/ItemNavigation.js +163 -105
  42. package/dist/delegate/ScrollEnablement.js +25 -19
  43. package/dist/features/F6Navigation.js +108 -0
  44. package/dist/features/OpenUI5Enablement.js +119 -0
  45. package/dist/features/OpenUI5Support.js +41 -6
  46. package/dist/generated/AssetParameters.js +1 -1
  47. package/dist/generated/VersionInfo.js +10 -0
  48. package/dist/generated/css/BusyIndicator.css.js +5 -0
  49. package/dist/generated/css/FontFace.css.js +5 -0
  50. package/dist/generated/css/OverrideFontFace.css.js +5 -0
  51. package/dist/generated/css/SystemCSSVars.css.js +5 -0
  52. package/dist/i18nBundle.js +38 -4
  53. package/dist/renderer/LitRenderer.js +39 -18
  54. package/dist/renderer/directives/style-map.js +72 -0
  55. package/dist/renderer/executeTemplate.js +19 -2
  56. package/dist/resources/bundle.esm.js +15 -104
  57. package/dist/resources/bundle.esm.js.map +1 -1
  58. package/dist/sap/base/Log.js +241 -0
  59. package/dist/sap/base/assert.js +8 -0
  60. package/dist/sap/base/security/URLListValidator.js +148 -0
  61. package/dist/sap/base/security/encodeCSS.js +14 -0
  62. package/dist/sap/base/security/encodeXML.js +23 -0
  63. package/dist/sap/base/security/sanitizeHTML.js +16 -0
  64. package/dist/sap/base/strings/toHex.js +8 -0
  65. package/dist/sap/base/util/now.js +7 -0
  66. package/dist/sap/ui/thirdparty/caja-html-sanitizer.js +3585 -0
  67. package/dist/test-resources/assets/Themes.js +8 -8
  68. package/dist/test-resources/elements/WithStaticArea.js +2 -1
  69. package/dist/test-resources/pages/AllTestElements.html +3 -0
  70. package/dist/test-resources/pages/i18n.html +2 -9
  71. package/dist/test-resources/specs/ConfigurationChange.spec.js +10 -8
  72. package/dist/test-resources/specs/ConfigurationScript.spec.js +25 -23
  73. package/dist/test-resources/specs/ConfigurationURL.spec.js +65 -17
  74. package/dist/test-resources/specs/CustomTheme.spec.js +9 -7
  75. package/dist/test-resources/specs/EventProvider.spec.js +63 -0
  76. package/dist/test-resources/specs/StaticArea.spec.js +56 -12
  77. package/dist/test-resources/specs/Theming.spec.js +12 -10
  78. package/dist/test-resources/specs/UI5ElementInvalidation.js +30 -28
  79. package/dist/test-resources/specs/UI5ElementLifecycle.js +12 -10
  80. package/dist/test-resources/specs/UI5ElementListenForChildPropChanges.spec.js +12 -10
  81. package/dist/test-resources/specs/UI5ElementMetadataExt.js +9 -7
  82. package/dist/test-resources/specs/UI5ElementPropertyValidation.js +7 -5
  83. package/dist/test-resources/specs/UI5ElementPropsAndAttrs.spec.js +37 -35
  84. package/dist/test-resources/specs/UI5ElementShadowDOM.js +10 -8
  85. package/dist/test-resources/specs/UI5ElementSlots.js +10 -8
  86. package/dist/theming/CustomStyle.js +23 -3
  87. package/dist/theming/applyTheme.js +11 -10
  88. package/dist/theming/getEffectiveLinksHrefs.js +27 -0
  89. package/dist/theming/getEffectiveStyle.js +9 -0
  90. package/dist/theming/getStylesString.js +4 -2
  91. package/dist/theming/getThemeDesignerTheme.js +25 -5
  92. package/dist/theming/preloadLinks.js +23 -0
  93. package/dist/types/CSSColor.js +9 -0
  94. package/dist/types/DataType.js +12 -0
  95. package/dist/types/Float.js +4 -0
  96. package/dist/types/Integer.js +4 -0
  97. package/dist/types/InvisibleMessageMode.js +30 -0
  98. package/dist/updateShadowRoot.js +8 -4
  99. package/dist/util/AriaLabelHelper.js +4 -4
  100. package/dist/util/ColorConversion.js +370 -0
  101. package/dist/util/FocusableElements.js +13 -7
  102. package/dist/util/HTMLSanitizer.js +7 -0
  103. package/dist/util/InvisibleMessage.js +60 -0
  104. package/dist/util/PopupUtils.js +93 -0
  105. package/dist/util/TabbableElements.js +5 -1
  106. package/dist/util/clamp.js +12 -0
  107. package/dist/util/createLinkInHead.js +19 -0
  108. package/dist/util/escapeRegex.js +10 -0
  109. package/dist/util/generateHighlightedMarkup.js +42 -0
  110. package/dist/util/getClassCopy.js +10 -0
  111. package/dist/util/getNormalizedTarget.js +16 -0
  112. package/dist/util/isElementInView.js +15 -0
  113. package/dist/util/isNodeHidden.js +1 -1
  114. package/dist/util/isNodeTabbable.js +4 -4
  115. package/hash.txt +1 -0
  116. package/index.js +1 -1
  117. package/lib/generate-asset-parameters/index.js +0 -1
  118. package/lib/generate-styles/index.js +18 -0
  119. package/lib/generate-version-info/index.js +27 -0
  120. package/package-scripts.js +31 -15
  121. package/package.json +19 -10
  122. package/src/AssetRegistry.js +8 -9
  123. package/src/Boot.js +17 -6
  124. package/src/CSP.js +59 -0
  125. package/src/CustomElementsRegistry.js +60 -4
  126. package/src/CustomElementsScope.js +20 -98
  127. package/src/CustomElementsScopeUtils.js +108 -0
  128. package/src/DOMObserver.js +6 -2
  129. package/src/Device.js +69 -776
  130. package/src/EventProvider.js +19 -25
  131. package/src/FeaturesRegistry.js +4 -1
  132. package/src/FontFace.js +7 -95
  133. package/src/InitialConfiguration.js +37 -21
  134. package/src/Keys.js +74 -0
  135. package/src/ManagedStyles.js +83 -0
  136. package/src/MediaRange.js +109 -0
  137. package/src/{util/parseProperties.js → PropertiesFileFormat.js} +6 -0
  138. package/src/Render.js +3 -2
  139. package/src/Runtimes.js +107 -0
  140. package/src/StaticArea.js +3 -0
  141. package/src/StaticAreaItem.js +31 -10
  142. package/src/SystemCSSVars.js +4 -25
  143. package/src/UI5Element.js +66 -65
  144. package/src/UI5ElementMetadata.js +18 -2
  145. package/src/asset-registries/Icons.js +117 -14
  146. package/src/asset-registries/Illustrations.js +30 -0
  147. package/src/asset-registries/LocaleData.js +97 -68
  148. package/src/asset-registries/Themes.js +23 -33
  149. package/src/asset-registries/i18n.js +61 -50
  150. package/src/assets-meta/IconCollectionsAlias.js +18 -0
  151. package/src/config/Icons.js +52 -0
  152. package/src/config/Language.js +15 -15
  153. package/src/config/Theme.js +25 -0
  154. package/src/css/BusyIndicator.css +76 -0
  155. package/src/css/FontFace.css +75 -0
  156. package/src/css/OverrideFontFace.css +32 -0
  157. package/src/css/SystemCSSVars.css +17 -0
  158. package/src/delegate/ItemNavigation.js +163 -105
  159. package/src/delegate/ScrollEnablement.js +25 -19
  160. package/src/features/F6Navigation.js +108 -0
  161. package/src/features/OpenUI5Enablement.js +119 -0
  162. package/src/features/OpenUI5Support.js +41 -6
  163. package/src/i18nBundle.js +38 -4
  164. package/src/renderer/LitRenderer.js +39 -18
  165. package/src/renderer/directives/style-map.js +72 -0
  166. package/src/renderer/executeTemplate.js +19 -2
  167. package/src/theming/CustomStyle.js +23 -3
  168. package/src/theming/applyTheme.js +11 -10
  169. package/src/theming/getEffectiveLinksHrefs.js +27 -0
  170. package/src/theming/getEffectiveStyle.js +9 -0
  171. package/src/theming/getStylesString.js +4 -2
  172. package/src/theming/getThemeDesignerTheme.js +25 -5
  173. package/src/theming/preloadLinks.js +23 -0
  174. package/src/types/CSSColor.js +9 -0
  175. package/src/types/DataType.js +12 -0
  176. package/src/types/Float.js +4 -0
  177. package/src/types/Integer.js +4 -0
  178. package/src/types/InvisibleMessageMode.js +30 -0
  179. package/src/updateShadowRoot.js +8 -4
  180. package/src/util/AriaLabelHelper.js +4 -4
  181. package/src/util/ColorConversion.js +370 -0
  182. package/src/util/FocusableElements.js +13 -7
  183. package/src/util/HTMLSanitizer.js +7 -0
  184. package/src/util/InvisibleMessage.js +60 -0
  185. package/src/util/PopupUtils.js +93 -0
  186. package/src/util/TabbableElements.js +5 -1
  187. package/src/util/clamp.js +12 -0
  188. package/src/util/createLinkInHead.js +19 -0
  189. package/src/util/escapeRegex.js +10 -0
  190. package/src/util/generateHighlightedMarkup.js +42 -0
  191. package/src/util/getClassCopy.js +10 -0
  192. package/src/util/getNormalizedTarget.js +16 -0
  193. package/src/util/isElementInView.js +15 -0
  194. package/src/util/isNodeHidden.js +1 -1
  195. package/src/util/isNodeTabbable.js +4 -4
  196. package/used-modules.txt +10 -0
  197. package/dist/SVGIconRegistry.js +0 -73
  198. package/dist/config/AssetsPath.js +0 -17
  199. package/dist/features/PropertiesFormatSupport.js +0 -8
  200. package/dist/renderer/ifDefined.js +0 -21
  201. package/dist/renderer/scopeHTML.js +0 -32
  202. package/dist/theming/createThemePropertiesStyleTag.js +0 -20
  203. package/dist/util/EffectiveAssetPath.js +0 -27
  204. package/dist/util/encodeCSS.js +0 -24
  205. package/src/SVGIconRegistry.js +0 -73
  206. package/src/config/AssetsPath.js +0 -17
  207. package/src/features/PropertiesFormatSupport.js +0 -8
  208. package/src/renderer/ifDefined.js +0 -21
  209. package/src/renderer/scopeHTML.js +0 -32
  210. package/src/theming/createThemePropertiesStyleTag.js +0 -20
  211. package/src/util/EffectiveAssetPath.js +0 -27
  212. package/src/util/encodeCSS.js +0 -24
@@ -1,11 +1,13 @@
1
1
  const assert = require("chai").assert;
2
2
 
3
3
  describe("Invalidation works", () => {
4
- 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
+ });
5
7
 
6
- it("Tests that changing a property invalidates", () => {
8
+ it("Tests that changing a property invalidates", async () => {
7
9
 
8
- const res = browser.executeAsync( async (done) => {
10
+ const res = await browser.executeAsync( async (done) => {
9
11
 
10
12
  const el = document.getElementById("gen");
11
13
 
@@ -21,15 +23,15 @@ describe("Invalidation works", () => {
21
23
 
22
24
  await window["sap-ui-webcomponents-bundle"].renderFinished();
23
25
 
24
- return done(invalidations);
26
+ done(invalidations);
25
27
  });
26
28
 
27
29
  assert.strictEqual(res, 2, "Invalidated 2 times");
28
30
  });
29
31
 
30
- 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 () => {
31
33
 
32
- const res = browser.executeAsync( async (done) => {
34
+ const res = await browser.executeAsync( async (done) => {
33
35
  const text = "some value";
34
36
 
35
37
  const el = document.getElementById("gen");
@@ -46,15 +48,15 @@ describe("Invalidation works", () => {
46
48
 
47
49
  await window["sap-ui-webcomponents-bundle"].renderFinished();
48
50
 
49
- return done(invalidations);
51
+ done(invalidations);
50
52
  });
51
53
 
52
54
  assert.strictEqual(res, 0, "Not invalidated");
53
55
  });
54
56
 
55
- it("Tests that setting a property of type Object always invalidates", () => {
57
+ it("Tests that setting a property of type Object always invalidates", async () => {
56
58
 
57
- const res = browser.executeAsync( async (done) => {
59
+ const res = await browser.executeAsync( async (done) => {
58
60
  const obj = {};
59
61
  const otherObj = {};
60
62
 
@@ -72,15 +74,15 @@ describe("Invalidation works", () => {
72
74
 
73
75
  await window["sap-ui-webcomponents-bundle"].renderFinished();
74
76
 
75
- return done(invalidations);
77
+ done(invalidations);
76
78
  });
77
79
 
78
80
  assert.strictEqual(res, 1, "Invalidated");
79
81
  });
80
82
 
81
- it("Tests that setting an array property always invalidates", () => {
83
+ it("Tests that setting an array property always invalidates", async () => {
82
84
 
83
- const res = browser.executeAsync( async (done) => {
85
+ const res = await browser.executeAsync( async (done) => {
84
86
  const arr = [];
85
87
  const otherArr = [];
86
88
 
@@ -98,15 +100,15 @@ describe("Invalidation works", () => {
98
100
 
99
101
  await window["sap-ui-webcomponents-bundle"].renderFinished();
100
102
 
101
- return done(invalidations);
103
+ done(invalidations);
102
104
  });
103
105
 
104
106
  assert.strictEqual(res, 1, "Invalidated");
105
107
  });
106
108
 
107
- it("Tests that adding a child invalidates", () => {
109
+ it("Tests that adding a child invalidates", async () => {
108
110
 
109
- const res = browser.executeAsync( async (done) => {
111
+ const res = await browser.executeAsync( async (done) => {
110
112
 
111
113
  const el = document.getElementById("gen");
112
114
 
@@ -122,15 +124,15 @@ describe("Invalidation works", () => {
122
124
 
123
125
  await window["sap-ui-webcomponents-bundle"].renderFinished();
124
126
 
125
- return done(invalidated);
127
+ done(invalidated);
126
128
  });
127
129
 
128
130
  assert.strictEqual(res, true, "Invalidated");
129
131
  });
130
132
 
131
- it("Tests that removing a child invalidates", () => {
133
+ it("Tests that removing a child invalidates", async () => {
132
134
 
133
- const res = browser.executeAsync( async (done) => {
135
+ const res = await browser.executeAsync( async (done) => {
134
136
 
135
137
  const el = document.getElementById("gen");
136
138
  const div = document.createElement("div");
@@ -148,15 +150,15 @@ describe("Invalidation works", () => {
148
150
 
149
151
  await window["sap-ui-webcomponents-bundle"].renderFinished();
150
152
 
151
- return done(invalidated);
153
+ done(invalidated);
152
154
  });
153
155
 
154
156
  assert.strictEqual(res, true, "Invalidated");
155
157
  });
156
158
 
157
- it("Tests that modifying textContent invalidates", () => {
159
+ it("Tests that modifying textContent invalidates", async () => {
158
160
 
159
- const res = browser.executeAsync( async (done) => {
161
+ const res = await browser.executeAsync( async (done) => {
160
162
 
161
163
  const el = document.getElementById("gen");
162
164
  el.textContent = "test";
@@ -173,15 +175,15 @@ describe("Invalidation works", () => {
173
175
 
174
176
  await window["sap-ui-webcomponents-bundle"].renderFinished();
175
177
 
176
- return done(invalidated);
178
+ done(invalidated);
177
179
  });
178
180
 
179
181
  assert.strictEqual(res, true, "Invalidated");
180
182
  });
181
183
 
182
- it("Tests that modifying nodeValue invalidates", () => {
184
+ it("Tests that modifying nodeValue invalidates", async () => {
183
185
 
184
- const res = browser.executeAsync( async (done) => {
186
+ const res = await browser.executeAsync( async (done) => {
185
187
 
186
188
  const el = document.getElementById("gen");
187
189
  el.textContent = "test";
@@ -198,15 +200,15 @@ describe("Invalidation works", () => {
198
200
 
199
201
  await window["sap-ui-webcomponents-bundle"].renderFinished();
200
202
 
201
- return done(invalidated);
203
+ done(invalidated);
202
204
  });
203
205
 
204
206
  assert.strictEqual(res, true, "Invalidated");
205
207
  });
206
208
 
207
- it("Tests that multiple invalidations result in a single rendering", () => {
209
+ it("Tests that multiple invalidations result in a single rendering", async () => {
208
210
 
209
- const res = browser.executeAsync( async (done) => {
211
+ const res = await browser.executeAsync( async (done) => {
210
212
 
211
213
  const el = document.getElementById("gen");
212
214
 
@@ -230,7 +232,7 @@ describe("Invalidation works", () => {
230
232
 
231
233
  await window["sap-ui-webcomponents-bundle"].renderFinished();
232
234
 
233
- return done(operations);
235
+ done(operations);
234
236
  });
235
237
 
236
238
  assert.strictEqual(res.invalidation, 2, "Invalidated 2 times");
@@ -1,11 +1,13 @@
1
1
  const assert = require("chai").assert;
2
2
 
3
3
  describe("Lifecycle works", () => {
4
- 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
+ });
5
7
 
6
- it("Tests element creation callbacks", () => {
8
+ it("Tests element creation callbacks", async () => {
7
9
 
8
- const res = browser.executeAsync( async (done) => {
10
+ const res = await browser.executeAsync( async (done) => {
9
11
  const creationCallbacks = ["onBeforeRendering", "onAfterRendering", "onEnterDOM"];
10
12
  const calledCallbacks = [];
11
13
 
@@ -22,7 +24,7 @@ describe("Lifecycle works", () => {
22
24
  document.body.appendChild(el);
23
25
  await window["sap-ui-webcomponents-bundle"].renderFinished();
24
26
 
25
- return done(calledCallbacks);
27
+ done(calledCallbacks);
26
28
  });
27
29
 
28
30
  assert.strictEqual(res.length, 3, "All 3 callbacks called");
@@ -31,9 +33,9 @@ describe("Lifecycle works", () => {
31
33
  assert.strictEqual(res[2], "onEnterDOM", "onEnterDOM called third");
32
34
  });
33
35
 
34
- it("Tests element invalidation callbacks", () => {
36
+ it("Tests element invalidation callbacks", async () => {
35
37
 
36
- const res = browser.executeAsync( async (done) => {
38
+ const res = await browser.executeAsync( async (done) => {
37
39
  const invalidationCallbacks = ["onBeforeRendering", "onAfterRendering"];
38
40
  const calledCallbacks = [];
39
41
 
@@ -54,7 +56,7 @@ describe("Lifecycle works", () => {
54
56
 
55
57
  await window["sap-ui-webcomponents-bundle"].renderFinished();
56
58
 
57
- return done(calledCallbacks);
59
+ done(calledCallbacks);
58
60
  });
59
61
 
60
62
  assert.strictEqual(res.length, 2, "All 2 callbacks called");
@@ -62,9 +64,9 @@ describe("Lifecycle works", () => {
62
64
  assert.strictEqual(res[1], "onAfterRendering", "onAfterRendering called second");
63
65
  });
64
66
 
65
- it("Tests element destruction callback", () => {
67
+ it("Tests element destruction callback", async () => {
66
68
 
67
- const res = browser.executeAsync( async (done) => {
69
+ const res = await browser.executeAsync( async (done) => {
68
70
  const destructionCallbacks = ["onExitDOM"];
69
71
  const calledCallbacks = [];
70
72
 
@@ -86,7 +88,7 @@ describe("Lifecycle works", () => {
86
88
 
87
89
  await window["sap-ui-webcomponents-bundle"].renderFinished();
88
90
 
89
- return done(calledCallbacks);
91
+ done(calledCallbacks);
90
92
  });
91
93
 
92
94
  assert.strictEqual(res.length, 1, "Only 1 callback was called");
@@ -1,11 +1,13 @@
1
1
  const assert = require("chai").assert;
2
2
 
3
3
  describe("Metadata slot invalidateOnChildChange works", () => {
4
- 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
+ });
5
7
 
6
- 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 () => {
7
9
 
8
- const res = browser.executeAsync( async (done) => {
10
+ const res = await browser.executeAsync( async (done) => {
9
11
  const parent = document.getElementById("parent");
10
12
  const child = document.getElementById("child1");
11
13
 
@@ -19,15 +21,15 @@ describe("Metadata slot invalidateOnChildChange works", () => {
19
21
 
20
22
  await window["sap-ui-webcomponents-bundle"].renderFinished();
21
23
 
22
- return done(parentInvalidated);
24
+ done(parentInvalidated);
23
25
  });
24
26
 
25
27
  assert.strictEqual(res, true, "Parent invalidated");
26
28
  });
27
29
 
28
- 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 () => {
29
31
 
30
- const res = browser.executeAsync( async (done) => {
32
+ const res = await browser.executeAsync( async (done) => {
31
33
  const parent = document.getElementById("parent");
32
34
  const child = document.getElementById("child1");
33
35
 
@@ -41,15 +43,15 @@ describe("Metadata slot invalidateOnChildChange works", () => {
41
43
 
42
44
  await window["sap-ui-webcomponents-bundle"].renderFinished();
43
45
 
44
- return done(parentInvalidated);
46
+ done(parentInvalidated);
45
47
  });
46
48
 
47
49
  assert.strictEqual(res, false, "Parent not invalidated");
48
50
  });
49
51
 
50
- it("Tests that listening for all properties works", () => {
52
+ it("Tests that listening for all properties works", async () => {
51
53
 
52
- const res = browser.executeAsync( async (done) => {
54
+ const res = await browser.executeAsync( async (done) => {
53
55
  const parent = document.getElementById("parent");
54
56
  const child = document.getElementById("child2");
55
57
 
@@ -65,7 +67,7 @@ describe("Metadata slot invalidateOnChildChange works", () => {
65
67
 
66
68
  await window["sap-ui-webcomponents-bundle"].renderFinished();
67
69
 
68
- return done(parentInvalidatedCount);
70
+ done(parentInvalidatedCount);
69
71
  });
70
72
 
71
73
  assert.strictEqual(res, 3, "Parent invalidated 3 times");
@@ -1,11 +1,13 @@
1
1
  const assert = require("chai").assert;
2
2
 
3
3
  describe("Metadata can be extended", () => {
4
- 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
+ });
5
7
 
6
- 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 () => {
7
9
 
8
- const res = browser.execute( () => {
10
+ const res = await browser.executeAsync(done => {
9
11
 
10
12
  const el = document.getElementById("genExt");
11
13
  const m = el.constructor.getMetadata();
@@ -15,15 +17,15 @@ describe("Metadata can be extended", () => {
15
17
  !!m.getSlots().default &&
16
18
  !!m.getSlots().extSlot;
17
19
 
18
- return ok;
20
+ done(ok);
19
21
  });
20
22
 
21
23
  assert.strictEqual(res, true, "Metadata properly extended");
22
24
  });
23
25
 
24
- it("When extending metadata, property defaultValue can be modified", () => {
26
+ it("When extending metadata, property defaultValue can be modified", async () => {
25
27
 
26
- const res = browser.execute( () => {
28
+ const res = await browser.executeAsync(done => {
27
29
 
28
30
  const el = document.getElementById("genExt");
29
31
  const m = el.constructor.getMetadata();
@@ -31,7 +33,7 @@ describe("Metadata can be extended", () => {
31
33
  const ok = !!m.getProperties().strProp &&
32
34
  m.getProperties().strProp.defaultValue === "Ext";
33
35
 
34
- return ok;
36
+ done(ok);
35
37
  });
36
38
 
37
39
  assert.strictEqual(res, true, "Property defaultValue changed");
@@ -1,12 +1,14 @@
1
1
  const assert = require("chai").assert;
2
2
 
3
3
  describe("Properties can only have values, restricted to their types", () => {
4
- 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
+ });
5
7
 
6
- it("String property enforced to string", () => {
7
- const el = browser.$("#gen");
8
- el.setProperty("strProp", 5);
9
- 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");
10
12
  });
11
13
 
12
14
  });
@@ -1,65 +1,67 @@
1
1
  const assert = require("chai").assert;
2
2
 
3
3
  describe("Properties and attributes convert to each other", () => {
4
- 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
+ });
5
7
 
6
- it("Tests that properties with default values are initialized with the default value", () => {
7
- 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");
8
10
 
9
- assert.strictEqual(el.getProperty("defaultValueProp"), "Hello", "defaultValueProp is properly initialized");
11
+ assert.strictEqual(await el.getProperty("defaultValueProp"), "Hello", "defaultValueProp is properly initialized");
10
12
  });
11
13
 
12
- it("Tests that prop-attr conversion works for string properties", () => {
13
- const el = browser.$("#gen");
14
+ it("Tests that prop-attr conversion works for string properties", async () => {
15
+ const el = await browser.$("#gen");
14
16
 
15
- el.setProperty("strProp", "test1");
16
- 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");
17
19
 
18
- el.setAttribute("str-prop", "test2");
19
- 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");
20
22
  });
21
23
 
22
- it("Tests that prop-attr conversion works for boolean properties", () => {
23
- const el = browser.$("#gen");
24
+ it("Tests that prop-attr conversion works for boolean properties", async () => {
25
+ const el = await browser.$("#gen");
24
26
 
25
- el.setProperty("boolProp", true);
26
- 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");
27
29
 
28
- el.setProperty("boolProp", false);
29
- 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");
30
32
 
31
- el.setAttribute("bool-prop", "");
32
- 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");
33
35
 
34
- el.removeAttribute("bool-prop");
35
- 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");
36
38
  });
37
39
 
38
- it("Tests that object properties have no attributes", () => {
39
- const el = browser.$("#gen");
40
+ it("Tests that object properties have no attributes", async () => {
41
+ const el = await browser.$("#gen");
40
42
 
41
- el.setProperty("objectProp", {});
42
- 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");
43
45
  });
44
46
 
45
- it("Tests that array properties have no attributes", () => {
46
- const el = browser.$("#gen");
47
+ it("Tests that array properties have no attributes", async () => {
48
+ const el = await browser.$("#gen");
47
49
 
48
- el.setProperty("multiProp", ["a", "b"]);
49
- 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");
50
52
  });
51
53
 
52
- it("Tests that noAttribute properties have no attributes", () => {
53
- const el = browser.$("#gen");
54
+ it("Tests that noAttribute properties have no attributes", async () => {
55
+ const el = await browser.$("#gen");
54
56
 
55
- el.setProperty("noAttributeProp", "some value");
56
- 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");
57
59
  });
58
60
 
59
- it("Tests that properties with default values do not automatically set attributes", () => {
60
- const el = browser.$("#gen");
61
+ it("Tests that properties with default values do not automatically set attributes", async () => {
62
+ const el = await browser.$("#gen");
61
63
 
62
- 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");
63
65
  });
64
66
 
65
67
  });
@@ -1,20 +1,22 @@
1
1
  const assert = require("chai").assert;
2
2
 
3
3
  describe("The framework can define web components", () => {
4
- 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
+ });
5
7
 
6
- it("Tests that element's Shadow DOM is rendered if it has a template", () => {
7
- const res = browser.execute(() => {
8
- return document.getElementById("gen").shadowRoot;
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);
9
11
  });
10
12
 
11
13
  assert.strictEqual(!!res, true, "Shadow root created");
12
- 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");
13
15
  });
14
16
 
15
- it("Tests that element's Shadow DOM is not rendered if it has no template", () => {
16
- const res = browser.execute(() => {
17
- return document.getElementById("noShadow").shadowRoot;
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);
18
20
  });
19
21
 
20
22
  assert.strictEqual(!!res, false, "Shadow root not created");
@@ -1,10 +1,12 @@
1
1
  const assert = require("chai").assert;
2
2
 
3
3
  describe("Slots work properly", () => {
4
- 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
+ });
5
7
 
6
- it("Tests that properties exist on the element for each slot", () => {
7
- const res = browser.execute(() => {
8
+ it("Tests that properties exist on the element for each slot", async () => {
9
+ const res = await browser.executeAsync(done => {
8
10
  const expectedValues = {};
9
11
 
10
12
  const el = document.getElementById("withContent");
@@ -15,7 +17,7 @@ describe("Slots work properly", () => {
15
17
  expectedValues.items = el.items.length === 2;
16
18
  expectedValues.named = el.named === undefined;
17
19
 
18
- return expectedValues;
20
+ done(expectedValues);
19
21
  });
20
22
 
21
23
  assert.strictEqual(res.default, true, "There are elements in the default property");
@@ -25,10 +27,10 @@ describe("Slots work properly", () => {
25
27
  assert.strictEqual(res.named, true, "There is no named property as propertyName changed it to items");
26
28
  });
27
29
 
28
- it("Tests that individualSlots modifies the slot property of slotted children", () => {
29
- assert.strictEqual(browser.$$("#withContent>[slot=individual]").length, 0, "There are no children with slot=individual");
30
- assert.strictEqual(browser.$$("#withContent>[slot=individual-1]").length, 1, "The slot of the first child became individual-1");
31
- 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");
32
34
  });
33
35
 
34
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
- fireCustomCSSChange(tag);
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 createThemePropertiesStyleTag from "./createThemePropertiesStyleTag.js";
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-theme-base";
7
+ const BASE_THEME_PACKAGE = "@ui5/webcomponents-theming";
8
8
 
9
9
  const isThemeBaseRegistered = () => {
10
10
  const registeredPackages = getRegisteredPackages();
@@ -16,15 +16,14 @@ const loadThemeBase = async theme => {
16
16
  return;
17
17
  }
18
18
 
19
- const cssText = await getThemeProperties(BASE_THEME_PACKAGE, theme);
20
- createThemePropertiesStyleTag(cssText, BASE_THEME_PACKAGE);
19
+ const cssData = await getThemeProperties(BASE_THEME_PACKAGE, theme);
20
+ if (cssData) {
21
+ createOrUpdateStyle(cssData, "data-ui5-theme-properties", BASE_THEME_PACKAGE);
22
+ }
21
23
  };
22
24
 
23
25
  const deleteThemeBase = () => {
24
- const styleElement = document.head.querySelector(`style[data-ui5-theme-properties="${BASE_THEME_PACKAGE}"]`);
25
- if (styleElement) {
26
- styleElement.parentElement.removeChild(styleElement);
27
- }
26
+ removeStyle("data-ui5-theme-properties", BASE_THEME_PACKAGE);
28
27
  };
29
28
 
30
29
  const loadComponentPackages = async theme => {
@@ -34,8 +33,10 @@ const loadComponentPackages = async theme => {
34
33
  return;
35
34
  }
36
35
 
37
- const cssText = await getThemeProperties(packageName, theme);
38
- createThemePropertiesStyleTag(cssText, packageName);
36
+ const cssData = await getThemeProperties(packageName, theme);
37
+ if (cssData) {
38
+ createOrUpdateStyle(cssData, "data-ui5-theme-properties", packageName);
39
+ }
39
40
  });
40
41
  };
41
42