@ui5/webcomponents-base 0.0.0-6895c16dd → 0.0.0-6cb3eb0db
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 -0
- package/CHANGELOG.md +39 -0
- package/README.md +26 -1
- package/bundle.esm.js +5 -0
- package/dist/Boot.js +15 -20
- package/dist/Device.js +2 -0
- package/dist/EventProvider.js +19 -25
- package/dist/InitialConfiguration.js +20 -15
- package/dist/Keys.js +15 -0
- package/dist/MediaRange.js +0 -1
- package/dist/Render.js +0 -1
- package/dist/StaticArea.js +3 -0
- package/dist/StaticAreaItem.js +30 -3
- package/dist/UI5Element.js +37 -43
- package/dist/UI5ElementMetadata.js +1 -1
- package/dist/asset-registries/Icons.js +10 -0
- package/dist/asset-registries/Illustrations.js +30 -0
- package/dist/delegate/ItemNavigation.js +66 -0
- package/dist/delegate/ScrollEnablement.js +7 -1
- package/dist/features/OpenUI5Support.js +41 -6
- package/dist/generated/AssetParameters.js +1 -1
- package/dist/i18nBundle.js +4 -0
- package/dist/renderer/LitRenderer.js +19 -18
- package/dist/resources/bundle.esm.js +17 -101
- package/dist/resources/bundle.esm.js.map +1 -1
- package/dist/sap/base/Log.js +241 -0
- package/dist/sap/base/assert.js +8 -0
- package/dist/sap/base/security/URLListValidator.js +148 -0
- package/dist/sap/base/security/sanitizeHTML.js +16 -0
- package/dist/sap/base/util/now.js +7 -0
- package/dist/sap/ui/thirdparty/caja-html-sanitizer.js +3585 -0
- package/dist/test-resources/elements/WithStaticArea.js +2 -1
- package/dist/test-resources/pages/AllTestElements.html +3 -0
- package/dist/test-resources/specs/ConfigurationChange.spec.js +10 -8
- package/dist/test-resources/specs/ConfigurationScript.spec.js +25 -23
- package/dist/test-resources/specs/ConfigurationURL.spec.js +65 -17
- package/dist/test-resources/specs/CustomTheme.spec.js +6 -4
- package/dist/test-resources/specs/EventProvider.spec.js +63 -0
- package/dist/test-resources/specs/StaticArea.spec.js +56 -12
- package/dist/test-resources/specs/Theming.spec.js +9 -7
- package/dist/test-resources/specs/UI5ElementInvalidation.js +30 -28
- package/dist/test-resources/specs/UI5ElementLifecycle.js +12 -10
- package/dist/test-resources/specs/UI5ElementListenForChildPropChanges.spec.js +12 -10
- package/dist/test-resources/specs/UI5ElementMetadataExt.js +9 -7
- package/dist/test-resources/specs/UI5ElementPropertyValidation.js +7 -5
- package/dist/test-resources/specs/UI5ElementPropsAndAttrs.spec.js +37 -35
- package/dist/test-resources/specs/UI5ElementShadowDOM.js +10 -8
- package/dist/test-resources/specs/UI5ElementSlots.js +10 -8
- package/dist/types/DataType.js +12 -0
- package/dist/types/Float.js +4 -0
- package/dist/types/Integer.js +4 -0
- package/dist/types/InvisibleMessageMode.js +30 -0
- package/dist/updateShadowRoot.js +1 -1
- package/dist/util/AriaLabelHelper.js +4 -4
- package/dist/util/FocusableElements.js +5 -1
- package/dist/util/HTMLSanitizer.js +7 -0
- package/dist/util/InvisibleMessage.js +58 -0
- package/dist/util/PopupUtils.js +93 -0
- package/dist/util/TabbableElements.js +1 -1
- package/dist/util/clamp.js +12 -0
- package/dist/util/getClassCopy.js +10 -0
- package/dist/util/isElementInView.js +15 -0
- package/dist/util/isNodeTabbable.js +4 -4
- package/hash.txt +1 -0
- package/index.js +1 -1
- package/package-scripts.js +30 -14
- package/package.json +20 -9
- package/src/Boot.js +15 -20
- package/src/Device.js +2 -0
- package/src/EventProvider.js +19 -25
- package/src/InitialConfiguration.js +20 -15
- package/src/Keys.js +15 -0
- package/src/MediaRange.js +0 -1
- package/src/Render.js +0 -1
- package/src/StaticArea.js +3 -0
- package/src/StaticAreaItem.js +30 -3
- package/src/UI5Element.js +37 -43
- package/src/UI5ElementMetadata.js +1 -1
- package/src/asset-registries/Icons.js +10 -0
- package/src/asset-registries/Illustrations.js +30 -0
- package/src/delegate/ItemNavigation.js +66 -0
- package/src/delegate/ScrollEnablement.js +7 -1
- package/src/features/OpenUI5Support.js +41 -6
- package/src/i18nBundle.js +4 -0
- package/src/renderer/LitRenderer.js +19 -18
- package/src/types/DataType.js +12 -0
- package/src/types/Float.js +4 -0
- package/src/types/Integer.js +4 -0
- package/src/types/InvisibleMessageMode.js +30 -0
- package/src/updateShadowRoot.js +1 -1
- package/src/util/AriaLabelHelper.js +4 -4
- package/src/util/FocusableElements.js +5 -1
- package/src/util/HTMLSanitizer.js +7 -0
- package/src/util/InvisibleMessage.js +58 -0
- package/src/util/PopupUtils.js +93 -0
- package/src/util/TabbableElements.js +1 -1
- package/src/util/clamp.js +12 -0
- package/src/util/getClassCopy.js +10 -0
- package/src/util/isElementInView.js +15 -0
- package/src/util/isNodeTabbable.js +4 -4
- package/used-modules.txt +7 -0
- package/dist/config/AssetsPath.js +0 -17
- package/dist/renderer/ifDefined.js +0 -21
- package/dist/renderer/scopeHTML.js +0 -32
- package/src/config/AssetsPath.js +0 -17
- package/src/renderer/ifDefined.js +0 -21
- package/src/renderer/scopeHTML.js +0 -32
|
@@ -27,8 +27,9 @@ class WithStaticArea extends UI5Element {
|
|
|
27
27
|
|
|
28
28
|
static get template() {
|
|
29
29
|
return element => {
|
|
30
|
+
// access effectiveDir getter to mark control as RTL-aware (test changes dir attribute and expects rerender)
|
|
30
31
|
return html`
|
|
31
|
-
<div>
|
|
32
|
+
<div dir=${element.effectiveDir}>
|
|
32
33
|
WithStaticArea works!
|
|
33
34
|
</div>`;
|
|
34
35
|
};
|
|
@@ -35,5 +35,8 @@
|
|
|
35
35
|
|
|
36
36
|
<ui5-with-static-area id="no-static-area"></ui5-with-static-area>
|
|
37
37
|
<ui5-with-static-area id="with-static-area" static-content></ui5-with-static-area>
|
|
38
|
+
<div id="with-static-area-rtl-container" dir="rtl">
|
|
39
|
+
<ui5-with-static-area id="with-static-area-rtl" static-content></ui5-with-static-area>
|
|
40
|
+
</div>
|
|
38
41
|
</body>
|
|
39
42
|
</html>
|
|
@@ -1,25 +1,27 @@
|
|
|
1
1
|
const assert = require("chai").assert;
|
|
2
2
|
|
|
3
3
|
describe("Some configuration options can be changed at runtime", () => {
|
|
4
|
-
|
|
4
|
+
before(async () => {
|
|
5
|
+
await browser.url("http://localhost:9191/test-resources/pages/Configuration.html");
|
|
6
|
+
});
|
|
5
7
|
|
|
6
|
-
it("Tests that theme can be changed", () => {
|
|
8
|
+
it("Tests that theme can be changed", async () => {
|
|
7
9
|
const newTheme = 'sap_belize_hcb';
|
|
8
10
|
|
|
9
|
-
const res = browser.executeAsync( async (newTheme, done) => {
|
|
11
|
+
const res = await browser.executeAsync( async (newTheme, done) => {
|
|
10
12
|
const config = window['sap-ui-webcomponents-bundle'].configuration;
|
|
11
13
|
await config.setTheme(newTheme);
|
|
12
|
-
|
|
14
|
+
done(config.getTheme());
|
|
13
15
|
}, newTheme);
|
|
14
16
|
assert.strictEqual(res, newTheme, "Theme changed to HCB");
|
|
15
17
|
});
|
|
16
18
|
|
|
17
|
-
it("Tests that noConflict can be changed", () => {
|
|
18
|
-
const res = browser.
|
|
19
|
+
it("Tests that noConflict can be changed", async () => {
|
|
20
|
+
const res = await browser.executeAsync(done => {
|
|
19
21
|
const config = window['sap-ui-webcomponents-bundle'].configuration;
|
|
20
22
|
config.setNoConflict({events: ["selection-change"]});
|
|
21
|
-
|
|
23
|
+
done(config.getNoConflict());
|
|
22
24
|
});
|
|
23
|
-
assert.
|
|
25
|
+
assert.include(res.events, "selection-change", "selection-change was successfully registered as a no conflict event");
|
|
24
26
|
});
|
|
25
27
|
});
|
|
@@ -1,60 +1,62 @@
|
|
|
1
1
|
const assert = require("chai").assert;
|
|
2
2
|
|
|
3
3
|
describe("Configuration script has effect", () => {
|
|
4
|
-
|
|
4
|
+
before(async () => {
|
|
5
|
+
await browser.url("http://localhost:9191/test-resources/pages/ConfigurationScript.html?do-not-change-configuration");
|
|
6
|
+
});
|
|
5
7
|
|
|
6
|
-
it("Tests that RTL is applied", () => {
|
|
7
|
-
const res = browser.
|
|
8
|
+
it("Tests that RTL is applied", async () => {
|
|
9
|
+
const res = await browser.executeAsync(done => {
|
|
8
10
|
const config = window['sap-ui-webcomponents-bundle'].configuration;
|
|
9
|
-
|
|
11
|
+
done(config.getRTL());
|
|
10
12
|
});
|
|
11
13
|
assert.strictEqual(res, true, "RTL is true");
|
|
12
14
|
});
|
|
13
15
|
|
|
14
|
-
it("Tests that language is applied", () => {
|
|
15
|
-
const res = browser.
|
|
16
|
+
it("Tests that language is applied", async () => {
|
|
17
|
+
const res = await browser.executeAsync(done => {
|
|
16
18
|
const config = window['sap-ui-webcomponents-bundle'].configuration;
|
|
17
|
-
|
|
19
|
+
done(config.getLanguage());
|
|
18
20
|
});
|
|
19
21
|
assert.strictEqual(res, 'ja', "language is japanese");
|
|
20
22
|
});
|
|
21
23
|
|
|
22
|
-
it("Tests that calendarType is applied", () => {
|
|
23
|
-
const res = browser.
|
|
24
|
+
it("Tests that calendarType is applied", async () => {
|
|
25
|
+
const res = await browser.executeAsync(done => {
|
|
24
26
|
const config = window['sap-ui-webcomponents-bundle'].configuration;
|
|
25
|
-
|
|
27
|
+
done(config.getCalendarType());
|
|
26
28
|
});
|
|
27
29
|
assert.strictEqual(res, 'Japanese', "calendarType is japanese");
|
|
28
30
|
});
|
|
29
31
|
|
|
30
|
-
it("Tests that formatSettings are applied", () => {
|
|
31
|
-
const res = browser.
|
|
32
|
+
it("Tests that formatSettings are applied", async () => {
|
|
33
|
+
const res = await browser.executeAsync(done => {
|
|
32
34
|
const config = window['sap-ui-webcomponents-bundle'].configuration;
|
|
33
|
-
|
|
35
|
+
done(config.getFirstDayOfWeek());
|
|
34
36
|
});
|
|
35
37
|
assert.strictEqual(res, 0, "First day of week is applied");
|
|
36
38
|
});
|
|
37
39
|
|
|
38
|
-
it("Tests that theme is applied", () => {
|
|
39
|
-
const res = browser.
|
|
40
|
+
it("Tests that theme is applied", async () => {
|
|
41
|
+
const res = await browser.executeAsync(done => {
|
|
40
42
|
const config = window['sap-ui-webcomponents-bundle'].configuration;
|
|
41
|
-
|
|
43
|
+
done(config.getTheme());
|
|
42
44
|
});
|
|
43
45
|
assert.strictEqual(res, 'sap_belize_hcb', "Thems is HCB");
|
|
44
46
|
});
|
|
45
47
|
|
|
46
|
-
it("Tests that noConflict is applied", () => {
|
|
47
|
-
const res = browser.
|
|
48
|
+
it("Tests that noConflict is applied", async () => {
|
|
49
|
+
const res = await browser.executeAsync(done => {
|
|
48
50
|
const config = window['sap-ui-webcomponents-bundle'].configuration;
|
|
49
|
-
|
|
51
|
+
done(config.getNoConflict());
|
|
50
52
|
});
|
|
51
|
-
assert.
|
|
53
|
+
assert.include(res.events, "selection-change", "selectionChange was successfully registered as a no conflict event");
|
|
52
54
|
});
|
|
53
55
|
|
|
54
|
-
it("Tests that animationMode is applied", () => {
|
|
55
|
-
const res = browser.
|
|
56
|
+
it("Tests that animationMode is applied", async () => {
|
|
57
|
+
const res = await browser.executeAsync(done => {
|
|
56
58
|
const config = window['sap-ui-webcomponents-bundle'].configuration;
|
|
57
|
-
|
|
59
|
+
done(config.getAnimationMode());
|
|
58
60
|
});
|
|
59
61
|
assert.strictEqual(res, 'basic', "animationMode is basic");
|
|
60
62
|
});
|
|
@@ -1,45 +1,93 @@
|
|
|
1
1
|
const assert = require("chai").assert;
|
|
2
2
|
|
|
3
|
-
describe("Some settings can be set via URL params", () => {
|
|
4
|
-
|
|
3
|
+
describe("Some settings can be set via SAP UI URL params", () => {
|
|
4
|
+
before(async () => {
|
|
5
|
+
await browser.url("http://localhost:9191/test-resources/pages/Configuration.html?sap-ui-rtl=true&sap-ui-language=ja&sap-ui-calendarType=Japanese&sap-ui-theme=sap_belize_hcb&sap-ui-animationMode=basic");
|
|
6
|
+
});
|
|
5
7
|
|
|
6
|
-
it("Tests that RTL is applied", () => {
|
|
7
|
-
const res = browser.
|
|
8
|
+
it("Tests that RTL is applied", async () => {
|
|
9
|
+
const res = await browser.executeAsync(done => {
|
|
8
10
|
const config = window['sap-ui-webcomponents-bundle'].configuration;
|
|
9
|
-
|
|
11
|
+
done(config.getRTL());
|
|
10
12
|
});
|
|
11
13
|
assert.strictEqual(res, true, "RTL is true");
|
|
12
14
|
});
|
|
13
15
|
|
|
14
|
-
it("Tests that language is applied", () => {
|
|
15
|
-
const res = browser.
|
|
16
|
+
it("Tests that language is applied", async () => {
|
|
17
|
+
const res = await browser.executeAsync(done => {
|
|
16
18
|
const config = window['sap-ui-webcomponents-bundle'].configuration;
|
|
17
|
-
|
|
19
|
+
done(config.getLanguage());
|
|
18
20
|
});
|
|
19
21
|
assert.strictEqual(res, 'ja', "language is japanese");
|
|
20
22
|
});
|
|
21
23
|
|
|
22
|
-
it("Tests that calendarType is applied", () => {
|
|
23
|
-
const res = browser.
|
|
24
|
+
it("Tests that calendarType is applied", async () => {
|
|
25
|
+
const res = await browser.executeAsync(done => {
|
|
24
26
|
const config = window['sap-ui-webcomponents-bundle'].configuration;
|
|
25
|
-
|
|
27
|
+
done(config.getCalendarType());
|
|
26
28
|
});
|
|
27
29
|
assert.strictEqual(res, 'Japanese', "calendarType is japanese");
|
|
28
30
|
});
|
|
29
31
|
|
|
30
|
-
it("Tests that theme is applied", () => {
|
|
31
|
-
const res = browser.
|
|
32
|
+
it("Tests that theme is applied", async () => {
|
|
33
|
+
const res = await browser.executeAsync(done => {
|
|
32
34
|
const config = window['sap-ui-webcomponents-bundle'].configuration;
|
|
33
|
-
|
|
35
|
+
done(config.getTheme());
|
|
34
36
|
});
|
|
35
37
|
assert.strictEqual(res, 'sap_belize_hcb', "Thems is HCB");
|
|
36
38
|
});
|
|
37
39
|
|
|
38
|
-
it("Tests that animationMode is applied", () => {
|
|
39
|
-
const res = browser.
|
|
40
|
+
it("Tests that animationMode is applied", async () => {
|
|
41
|
+
const res = await browser.executeAsync(done => {
|
|
40
42
|
const config = window['sap-ui-webcomponents-bundle'].configuration;
|
|
41
|
-
|
|
43
|
+
done(config.getAnimationMode());
|
|
42
44
|
});
|
|
43
45
|
assert.strictEqual(res, 'basic', "animationMode is basic");
|
|
44
46
|
});
|
|
45
47
|
});
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
describe("Some settings can be set via SAP URL params", () => {
|
|
51
|
+
before(async () => {
|
|
52
|
+
await browser.url("http://localhost:9191/test-resources/pages/Configuration.html?sap-language=bg&sap-theme=sap_fiori_3_dark");
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
it("Tests that language is applied", async () => {
|
|
56
|
+
const res = await browser.executeAsync(done => {
|
|
57
|
+
const config = window['sap-ui-webcomponents-bundle'].configuration;
|
|
58
|
+
done(config.getLanguage());
|
|
59
|
+
});
|
|
60
|
+
assert.strictEqual(res, 'bg', "language is bulgarian");
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
it("Tests that theme is applied", async () => {
|
|
64
|
+
const res = await browser.executeAsync(done => {
|
|
65
|
+
const config = window['sap-ui-webcomponents-bundle'].configuration;
|
|
66
|
+
done(config.getTheme());
|
|
67
|
+
});
|
|
68
|
+
assert.strictEqual(res, 'sap_fiori_3_dark', "Thems is Fiori Dark");
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
describe("SAP UI params take precedence over the SAP params", () => {
|
|
74
|
+
before(async () => {
|
|
75
|
+
await browser.url("http://localhost:9191/test-resources/pages/Configuration.html?sap-language=bg&sap-ui-language=de&sap-theme=sap_fiori_3_dark&sap-theme=sap_fiori_3_hcb");
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
it("Tests that language is applied via sap-ui-language", async () => {
|
|
79
|
+
const res = await browser.executeAsync(done => {
|
|
80
|
+
const config = window['sap-ui-webcomponents-bundle'].configuration;
|
|
81
|
+
done(config.getLanguage());
|
|
82
|
+
});
|
|
83
|
+
assert.strictEqual(res, 'de', "language is german");
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
it("Tests that theme is applied via sap-ui-theme", async () => {
|
|
87
|
+
const res = await browser.executeAsync(done => {
|
|
88
|
+
const config = window['sap-ui-webcomponents-bundle'].configuration;
|
|
89
|
+
done(config.getTheme());
|
|
90
|
+
});
|
|
91
|
+
assert.strictEqual(res, 'sap_fiori_3_hcb', "Thems is Fiori HCB");
|
|
92
|
+
});
|
|
93
|
+
});
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
const assert = require("chai").assert;
|
|
2
2
|
|
|
3
3
|
describe("Custom themes can be registered", () => {
|
|
4
|
-
|
|
4
|
+
before(async () => {
|
|
5
|
+
await browser.url("http://localhost:9191/test-resources/pages/AllTestElements.html");
|
|
6
|
+
});
|
|
5
7
|
|
|
6
|
-
it("Tests that theme parameters are changed on theme change", () => {
|
|
8
|
+
it("Tests that theme parameters are changed on theme change", async () => {
|
|
7
9
|
const newTheme = 'my_custom_theme';
|
|
8
10
|
|
|
9
|
-
const res = browser.executeAsync( async (newTheme, done) => {
|
|
11
|
+
const res = await browser.executeAsync( async (newTheme, done) => {
|
|
10
12
|
const var1 = "--var1: #555555";
|
|
11
13
|
|
|
12
14
|
window.registerThemePropertiesLoader("@ui5/webcomponents-base-test", newTheme, () => `:root{ ${var1}; }`);
|
|
@@ -16,7 +18,7 @@ describe("Custom themes can be registered", () => {
|
|
|
16
18
|
|
|
17
19
|
const style = document.querySelector(`style[data-ui5-theme-properties="@ui5/webcomponents-base-test"]`);
|
|
18
20
|
const varsFound = style && style.textContent.includes(var1);
|
|
19
|
-
|
|
21
|
+
done(varsFound);
|
|
20
22
|
}, newTheme);
|
|
21
23
|
|
|
22
24
|
assert.strictEqual(res, true, "Theme parameters changed");
|
|
@@ -0,0 +1,63 @@
|
|
|
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,24 +1,26 @@
|
|
|
1
1
|
const assert = require("chai").assert;
|
|
2
2
|
|
|
3
3
|
describe("Some configuration options can be changed at runtime", () => {
|
|
4
|
-
|
|
4
|
+
before(async () => {
|
|
5
|
+
await browser.url("http://localhost:9191/test-resources/pages/AllTestElements.html");
|
|
6
|
+
});
|
|
5
7
|
|
|
6
|
-
it("Tests control with no static area item", () => {
|
|
7
|
-
const componentId = browser.$("#no-static-area").getProperty("_id");
|
|
8
|
-
const staticArea = browser.$("ui5-static-area");
|
|
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");
|
|
9
11
|
|
|
10
|
-
assert.notOk(staticArea.$(`.${componentId}`).isExisting(), "No static area item is defined for this control");
|
|
12
|
+
assert.notOk(await staticArea.$(`.${componentId}`).isExisting(), "No static area item is defined for this control");
|
|
11
13
|
});
|
|
12
14
|
|
|
13
|
-
it("Tests control with static area item", () => {
|
|
14
|
-
const componentId = browser.$("#with-static-area").getProperty("_id");
|
|
15
|
-
const staticArea = browser.$("ui5-static-area");
|
|
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");
|
|
16
18
|
|
|
17
|
-
assert.ok(staticArea.$(`.${componentId}`).isExisting(), "No static area item is defined for this control");
|
|
19
|
+
assert.ok(await staticArea.$(`.${componentId}`).isExisting(), "No static area item is defined for this control");
|
|
18
20
|
});
|
|
19
21
|
|
|
20
|
-
it("Tests removing an element with static area", () => {
|
|
21
|
-
const result = browser.
|
|
22
|
+
it("Tests removing an element with static area", async () => {
|
|
23
|
+
const result = await browser.executeAsync(done => {
|
|
22
24
|
let res = true;
|
|
23
25
|
window.onerror = (errorMsg, url, lineNumber) => {
|
|
24
26
|
res = false;
|
|
@@ -26,9 +28,51 @@ describe("Some configuration options can be changed at runtime", () => {
|
|
|
26
28
|
|
|
27
29
|
document.querySelector("#no-static-area").remove();
|
|
28
30
|
|
|
29
|
-
|
|
31
|
+
done(res);
|
|
30
32
|
});
|
|
31
33
|
|
|
32
34
|
assert.ok(result, "Static area removed from DOM successfully");
|
|
33
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
|
+
});
|
|
34
78
|
});
|
|
@@ -1,28 +1,30 @@
|
|
|
1
1
|
const assert = require("chai").assert;
|
|
2
2
|
|
|
3
3
|
describe("Theming works", () => {
|
|
4
|
-
|
|
4
|
+
before(async () => {
|
|
5
|
+
await browser.url("http://localhost:9191/test-resources/pages/AllTestElements.html");
|
|
6
|
+
});
|
|
5
7
|
|
|
6
|
-
it("Tests that the parameters for the default theme are embedded on boot", () => {
|
|
8
|
+
it("Tests that the parameters for the default theme are embedded on boot", async () => {
|
|
7
9
|
|
|
8
|
-
const res = browser.
|
|
10
|
+
const res = await browser.executeAsync(done => {
|
|
9
11
|
const style = document.querySelector(`style[data-ui5-theme-properties="@ui5/webcomponents-base-test"]`);
|
|
10
|
-
|
|
12
|
+
done(style && style.textContent.includes("--var1: red")); // see test/assets/Themes.js
|
|
11
13
|
});
|
|
12
14
|
|
|
13
15
|
assert.strictEqual(res, true, "The fiori3 vars are found");
|
|
14
16
|
});
|
|
15
17
|
|
|
16
|
-
it("Tests that theme parameters are changed on theme change", () => {
|
|
18
|
+
it("Tests that theme parameters are changed on theme change", async () => {
|
|
17
19
|
const newTheme = 'sap_belize_hcb';
|
|
18
20
|
|
|
19
|
-
const res = browser.executeAsync( async (newTheme, done) => {
|
|
21
|
+
const res = await browser.executeAsync( async (newTheme, done) => {
|
|
20
22
|
const config = window['sap-ui-webcomponents-bundle'].configuration;
|
|
21
23
|
await config.setTheme(newTheme);
|
|
22
24
|
|
|
23
25
|
const style = document.querySelector(`style[data-ui5-theme-properties="@ui5/webcomponents-base-test"]`);
|
|
24
26
|
const varsFound = style && style.textContent.includes("--var1: orange"); // see test/assets/Themes.js
|
|
25
|
-
|
|
27
|
+
done(varsFound);
|
|
26
28
|
}, newTheme);
|
|
27
29
|
|
|
28
30
|
assert.strictEqual(res, true, "Theme parameters changed");
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
const assert = require("chai").assert;
|
|
2
2
|
|
|
3
3
|
describe("Invalidation works", () => {
|
|
4
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
235
|
+
done(operations);
|
|
234
236
|
});
|
|
235
237
|
|
|
236
238
|
assert.strictEqual(res.invalidation, 2, "Invalidated 2 times");
|