@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
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
const assert = require("chai").assert;
|
|
2
2
|
|
|
3
3
|
describe("Lifecycle works", () => {
|
|
4
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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.
|
|
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
|
-
|
|
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.
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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.
|
|
8
|
-
|
|
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.
|
|
17
|
-
|
|
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
|
-
|
|
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.
|
|
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
|
-
|
|
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
|
});
|
package/dist/types/DataType.js
CHANGED
|
@@ -11,6 +11,18 @@ class DataType {
|
|
|
11
11
|
static isValid(value) {
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
+
static attributeToProperty(attributeValue) {
|
|
15
|
+
return attributeValue;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
static propertyToAttribute(propertyValue) {
|
|
19
|
+
return `${propertyValue}`;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
static valuesAreEqual(value1, value2) {
|
|
23
|
+
return value1 === value2;
|
|
24
|
+
}
|
|
25
|
+
|
|
14
26
|
static generateTypeAccessors(types) {
|
|
15
27
|
Object.keys(types).forEach(type => {
|
|
16
28
|
Object.defineProperty(this, type, {
|
package/dist/types/Float.js
CHANGED
package/dist/types/Integer.js
CHANGED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import DataType from "./DataType.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Enumeration for different mode behaviors of the <code>InvisibleMessage</code>.
|
|
5
|
+
* @private
|
|
6
|
+
*/
|
|
7
|
+
const InvisibleMessageModes = {
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Indicates that updates to the region should be presented at the next graceful opportunity,
|
|
11
|
+
* such as at the end of reading the current sentence, or when the user pauses typing.
|
|
12
|
+
*/
|
|
13
|
+
Polite: "Polite",
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Indicates that updates to the region have the highest priority and should be presented to the user immediately.
|
|
17
|
+
*/
|
|
18
|
+
Assertive: "Assertive",
|
|
19
|
+
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
class InvisibleMessageMode extends DataType {
|
|
23
|
+
static isValid(value) {
|
|
24
|
+
return !!InvisibleMessageModes[value];
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
InvisibleMessageMode.generateTypeAccessors(InvisibleMessageModes);
|
|
29
|
+
|
|
30
|
+
export default InvisibleMessageModes;
|
package/dist/updateShadowRoot.js
CHANGED
|
@@ -20,7 +20,7 @@ const updateShadowRoot = (element, forStaticArea = false) => {
|
|
|
20
20
|
styleToPrepend = getEffectiveStyle(element.constructor, forStaticArea);
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
element.constructor.render(renderResult, shadowRoot, styleToPrepend, {
|
|
23
|
+
element.constructor.render(renderResult, shadowRoot, styleToPrepend, { host: element });
|
|
24
24
|
};
|
|
25
25
|
|
|
26
26
|
export default updateShadowRoot;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import findNodeOwner from "./findNodeOwner.js";
|
|
2
2
|
|
|
3
3
|
const getEffectiveAriaLabelText = el => {
|
|
4
|
-
if (!el.
|
|
5
|
-
if (el.
|
|
6
|
-
return el.
|
|
4
|
+
if (!el.accessibleNameRef) {
|
|
5
|
+
if (el.accessibleName) {
|
|
6
|
+
return el.accessibleName;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
return undefined;
|
|
@@ -19,7 +19,7 @@ const getEffectiveAriaLabelText = el => {
|
|
|
19
19
|
* @param {String} readyIds (Optional) Defines a string of elements ids. The text of these elements will be returned. If used you should provide either el or ownerDocument
|
|
20
20
|
*/
|
|
21
21
|
const getAriaLabelledByTexts = (el, ownerDocument, readyIds = "") => {
|
|
22
|
-
const ids = (readyIds && readyIds.split(" ")) || el.
|
|
22
|
+
const ids = (readyIds && readyIds.split(" ")) || el.accessibleNameRef.split(" ");
|
|
23
23
|
const owner = ownerDocument || findNodeOwner(el);
|
|
24
24
|
let result = "";
|
|
25
25
|
|
|
@@ -21,6 +21,10 @@ const getLastFocusableElement = async container => {
|
|
|
21
21
|
return findFocusableElement(container, false);
|
|
22
22
|
};
|
|
23
23
|
|
|
24
|
+
const isElemFocusable = el => {
|
|
25
|
+
return el.hasAttribute("data-ui5-focus-redirect") || !isNodeHidden(el);
|
|
26
|
+
};
|
|
27
|
+
|
|
24
28
|
const findFocusableElement = async (container, forward) => {
|
|
25
29
|
let child;
|
|
26
30
|
|
|
@@ -48,7 +52,7 @@ const findFocusableElement = async (container, forward) => {
|
|
|
48
52
|
return null;
|
|
49
53
|
}
|
|
50
54
|
|
|
51
|
-
if (child.nodeType === 1 &&
|
|
55
|
+
if (child.nodeType === 1 && isElemFocusable(child) && !isFocusTrap(child)) {
|
|
52
56
|
if (isNodeClickable(child)) {
|
|
53
57
|
return (child && typeof child.focus === "function") ? child : null;
|
|
54
58
|
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import InvisibleMessageMode from "../types/InvisibleMessageMode.js";
|
|
2
|
+
import getSingletonElementInstance from "./getSingletonElementInstance.js";
|
|
3
|
+
import { attachBoot } from "../Boot.js";
|
|
4
|
+
|
|
5
|
+
let politeSpan;
|
|
6
|
+
let assertiveSpan;
|
|
7
|
+
|
|
8
|
+
attachBoot(() => {
|
|
9
|
+
if (politeSpan && assertiveSpan) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const styles = `position: absolute;
|
|
14
|
+
clip: rect(1px,1px,1px,1px);
|
|
15
|
+
user-select: none;
|
|
16
|
+
left: -1000px;
|
|
17
|
+
top: -1000px;
|
|
18
|
+
pointer-events: none;`;
|
|
19
|
+
|
|
20
|
+
politeSpan = document.createElement("span");
|
|
21
|
+
assertiveSpan = document.createElement("span");
|
|
22
|
+
|
|
23
|
+
politeSpan.classList.add("ui5-invisiblemessage-polite");
|
|
24
|
+
assertiveSpan.classList.add("ui5-invisiblemessage-assertive");
|
|
25
|
+
|
|
26
|
+
politeSpan.setAttribute("aria-live", "polite");
|
|
27
|
+
assertiveSpan.setAttribute("aria-live", "assertive");
|
|
28
|
+
|
|
29
|
+
politeSpan.setAttribute("role", "alert");
|
|
30
|
+
assertiveSpan.setAttribute("role", "alert");
|
|
31
|
+
|
|
32
|
+
politeSpan.style.cssText = styles;
|
|
33
|
+
assertiveSpan.style.cssText = styles;
|
|
34
|
+
|
|
35
|
+
getSingletonElementInstance("ui5-static-area").appendChild(politeSpan);
|
|
36
|
+
getSingletonElementInstance("ui5-static-area").appendChild(assertiveSpan);
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Inserts the string into the respective span, depending on the mode provided.
|
|
41
|
+
*
|
|
42
|
+
* @param {string} message String to be announced by the screen reader.
|
|
43
|
+
* @param {sap.ui.core.InvisibleMessageMode} mode The mode to be inserted in the aria-live attribute.
|
|
44
|
+
*/
|
|
45
|
+
const announce = (message, mode) => {
|
|
46
|
+
// If no type is presented, fallback to polite announcement.
|
|
47
|
+
const span = mode === InvisibleMessageMode.Assertive ? assertiveSpan : politeSpan;
|
|
48
|
+
|
|
49
|
+
// Set textContent to empty string in order to trigger screen reader's announcement.
|
|
50
|
+
span.textContent = "";
|
|
51
|
+
span.textContent = message;
|
|
52
|
+
|
|
53
|
+
if (mode !== InvisibleMessageMode.Assertive && mode !== InvisibleMessageMode.Polite) {
|
|
54
|
+
console.warn(`You have entered an invalid mode. Valid values are: "Polite" and "Assertive". The framework will automatically set the mode to "Polite".`); // eslint-disable-line
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export default announce;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import getSharedResource from "../getSharedResource.js";
|
|
2
|
+
import { getFeature } from "../FeaturesRegistry.js";
|
|
3
|
+
import getActiveElement from "./getActiveElement.js";
|
|
4
|
+
|
|
5
|
+
const PopupUtilsData = getSharedResource("PopupUtilsData", {});
|
|
6
|
+
PopupUtilsData.currentZIndex = PopupUtilsData.currentZIndex || 100;
|
|
7
|
+
|
|
8
|
+
const getFocusedElement = () => {
|
|
9
|
+
const element = getActiveElement();
|
|
10
|
+
return (element && typeof element.focus === "function") ? element : null;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const isFocusedElementWithinNode = node => {
|
|
14
|
+
const fe = getFocusedElement();
|
|
15
|
+
|
|
16
|
+
if (fe) {
|
|
17
|
+
return isNodeContainedWithin(node, fe);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return false;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const isNodeContainedWithin = (parent, child) => {
|
|
24
|
+
let currentNode = parent;
|
|
25
|
+
|
|
26
|
+
if (currentNode.shadowRoot) {
|
|
27
|
+
currentNode = Array.from(currentNode.shadowRoot.children).find(n => n.localName !== "style");
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if (currentNode === child) {
|
|
31
|
+
return true;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const childNodes = currentNode.localName === "slot" ? currentNode.assignedNodes() : currentNode.children;
|
|
35
|
+
|
|
36
|
+
if (childNodes) {
|
|
37
|
+
return Array.from(childNodes).some(n => isNodeContainedWithin(n, child));
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const isPointInRect = (x, y, rect) => {
|
|
42
|
+
return x >= rect.left && x <= rect.right
|
|
43
|
+
&& y >= rect.top && y <= rect.bottom;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
const isClickInRect = (event, rect) => {
|
|
47
|
+
let x;
|
|
48
|
+
let y;
|
|
49
|
+
|
|
50
|
+
if (event.touches) {
|
|
51
|
+
const touch = event.touches[0];
|
|
52
|
+
x = touch.clientX;
|
|
53
|
+
y = touch.clientY;
|
|
54
|
+
} else {
|
|
55
|
+
x = event.clientX;
|
|
56
|
+
y = event.clientY;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return isPointInRect(x, y, rect);
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
const getClosedPopupParent = el => {
|
|
63
|
+
const parent = el.parentElement || (el.getRootNode && el.getRootNode().host);
|
|
64
|
+
|
|
65
|
+
if (parent && ((parent.showAt && parent.isUI5Element) || (parent.open && parent.isUI5Element) || parent === document.documentElement)) {
|
|
66
|
+
return parent;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return getClosedPopupParent(parent);
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
const getNextZIndex = () => {
|
|
73
|
+
const OpenUI5Support = getFeature("OpenUI5Support");
|
|
74
|
+
if (OpenUI5Support && OpenUI5Support.isLoaded()) { // use OpenUI5 for getting z-index values, if loaded
|
|
75
|
+
return OpenUI5Support.getNextZIndex();
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
PopupUtilsData.currentZIndex += 2;
|
|
79
|
+
return PopupUtilsData.currentZIndex;
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
const getCurrentZIndex = () => {
|
|
83
|
+
return PopupUtilsData.currentZIndex;
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
export {
|
|
87
|
+
getFocusedElement,
|
|
88
|
+
isClickInRect,
|
|
89
|
+
getClosedPopupParent,
|
|
90
|
+
getNextZIndex,
|
|
91
|
+
getCurrentZIndex,
|
|
92
|
+
isFocusedElementWithinNode,
|
|
93
|
+
};
|