@ui5/webcomponents-base 2.11.0-rc.2 → 2.11.0-rc.3
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/CHANGELOG.md +8 -0
- package/dist/.tsbuildinfobuild +1 -1
- package/dist/features/OpenUI5Support.d.ts +1 -0
- package/dist/features/OpenUI5Support.js +30 -27
- package/dist/features/OpenUI5Support.js.map +1 -1
- package/dist/generated/VersionInfo.js +3 -3
- package/dist/generated/VersionInfo.js.map +1 -1
- package/dist/prod/features/OpenUI5Support.js +1 -1
- package/dist/prod/features/OpenUI5Support.js.map +2 -2
- package/dist/prod/generated/VersionInfo.js +1 -1
- package/dist/prod/generated/VersionInfo.js.map +1 -1
- package/package.json +3 -3
- package/cypress/specs/Accessor.cy.tsx +0 -79
- package/cypress/specs/Boot.cy.tsx +0 -19
- package/cypress/specs/ConfigurationChange.cy.tsx +0 -41
- package/cypress/specs/ConfigurationScript.cy.tsx +0 -133
- package/cypress/specs/ConfigurationURL.cy.tsx +0 -201
- package/cypress/specs/CustomMount.cy.tsx +0 -9
- package/cypress/specs/CustomTheme.cy.tsx +0 -36
- package/cypress/specs/EventProvider.cy.tsx +0 -59
- package/cypress/specs/Events.cy.tsx +0 -28
- package/cypress/specs/SystemDOMElements.cy.tsx +0 -8
- package/cypress/specs/Theming.cy.tsx +0 -74
- package/cypress/specs/UI5ElementInvalidation.cy.tsx +0 -252
- package/cypress/specs/UI5ElementLifecycle.cy.tsx +0 -82
- package/cypress/specs/UI5ElementListenForChildPropChanges.cy.tsx +0 -83
- package/cypress/specs/UI5ElementMetadataExt.cy.tsx +0 -42
- package/cypress/specs/UI5ElementPropertyValidation.cy.tsx +0 -16
- package/cypress/specs/UI5ElementPropsAndAttrs.cy.tsx +0 -113
- package/cypress/specs/UI5ElementShadowDOM.cy.tsx +0 -30
- package/cypress/specs/UI5ElementSlots.cy.tsx +0 -136
- package/cypress/specs/WithComplexTemplate.cy.tsx +0 -32
- package/cypress/specs/i18n_texts.cy.tsx +0 -129
- package/cypress/specs/util/FocusableElements.cy.tsx +0 -48
- package/cypress/support/commands.ts +0 -39
- package/cypress/support/component-index.html +0 -12
- package/cypress/support/component.ts +0 -17
- package/cypress/tsconfig.json +0 -21
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import type UI5Element from "../../src/UI5Element.js";
|
|
2
|
-
import Generic from "../../test/test-elements/Generic.js";
|
|
3
|
-
|
|
4
|
-
describe("Lifecycle works", () => {
|
|
5
|
-
it("Tests that changing a property invalidates", () => {
|
|
6
|
-
const el = document.createElement("ui5-test-generic");
|
|
7
|
-
|
|
8
|
-
cy.mount(<div id="container"></div>);
|
|
9
|
-
|
|
10
|
-
cy.spy<UI5Element>((el as UI5Element), "onBeforeRendering").as("onBeforeRendering");
|
|
11
|
-
|
|
12
|
-
cy.spy<UI5Element>((el as UI5Element), "onAfterRendering").as("onAfterRendering");
|
|
13
|
-
|
|
14
|
-
cy.spy<UI5Element>((el as UI5Element), "onEnterDOM").as("onEnterDOM");
|
|
15
|
-
|
|
16
|
-
cy.get("#container")
|
|
17
|
-
.then($container => {
|
|
18
|
-
$container.append(el);
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
cy.get("@onBeforeRendering")
|
|
22
|
-
.should("have.been.called")
|
|
23
|
-
.and("have.been.calledBefore", "@onAfterRendering")
|
|
24
|
-
.and("have.been.calledBefore", "@onEnterDOM");
|
|
25
|
-
|
|
26
|
-
cy.get("@onAfterRendering")
|
|
27
|
-
.should("have.been.called")
|
|
28
|
-
.and("have.been.calledBefore", "@onEnterDOM");
|
|
29
|
-
|
|
30
|
-
cy.get("@onEnterDOM")
|
|
31
|
-
.should("have.been.called");
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
it("Tests element invalidation callbacks", () => {
|
|
35
|
-
cy.mount(<Generic></Generic>);
|
|
36
|
-
|
|
37
|
-
cy.get("[ui5-test-generic]")
|
|
38
|
-
.as("testGeneric")
|
|
39
|
-
.then($testGeneric => {
|
|
40
|
-
cy.spy<UI5Element>(($testGeneric.get(0) as UI5Element), "onBeforeRendering").as("onBeforeRendering");
|
|
41
|
-
|
|
42
|
-
cy.spy<UI5Element>(($testGeneric.get(0) as UI5Element), "onAfterRendering").as("onAfterRendering");
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
cy.get("@testGeneric")
|
|
46
|
-
.invoke("prop", "strProp", "some string");
|
|
47
|
-
|
|
48
|
-
cy.get("@onBeforeRendering")
|
|
49
|
-
.should("have.been.called")
|
|
50
|
-
.and("have.been.calledBefore", "@onAfterRendering");
|
|
51
|
-
|
|
52
|
-
cy.get("@onAfterRendering")
|
|
53
|
-
.should("have.been.called");
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
it("Tests element destruction callback", () => {
|
|
57
|
-
const el = document.createElement("ui5-test-generic");
|
|
58
|
-
|
|
59
|
-
cy.mount(<div id="container"></div>);
|
|
60
|
-
|
|
61
|
-
cy.spy<UI5Element>((el as UI5Element), "onExitDOM").as("onExitDOM");
|
|
62
|
-
cy.spy<UI5Element>((el as UI5Element), "onEnterDOM").as("onEnterDOM");
|
|
63
|
-
|
|
64
|
-
cy.get("#container")
|
|
65
|
-
.then($container => {
|
|
66
|
-
$container.append(el);
|
|
67
|
-
|
|
68
|
-
return $container;
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
cy.get("@onEnterDOM")
|
|
72
|
-
.should("have.been.called");
|
|
73
|
-
|
|
74
|
-
cy.wrap(el)
|
|
75
|
-
.then($el => {
|
|
76
|
-
$el.remove();
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
cy.get("@onExitDOM")
|
|
80
|
-
.should("have.been.called");
|
|
81
|
-
});
|
|
82
|
-
});
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import type UI5Element from "../../src/UI5Element.js";
|
|
2
|
-
|
|
3
|
-
import Parent from "../../test/test-elements/Parent.js";
|
|
4
|
-
import Child from "../../test/test-elements/Child.js";
|
|
5
|
-
|
|
6
|
-
describe("Invalidation works", () => {
|
|
7
|
-
it("Tests that changing a monitored property of a child invalidates the parent", () => {
|
|
8
|
-
cy.mount(
|
|
9
|
-
<Parent>
|
|
10
|
-
<Child></Child>
|
|
11
|
-
</Parent>
|
|
12
|
-
);
|
|
13
|
-
|
|
14
|
-
cy.get<Parent>("[ui5-test-parent]")
|
|
15
|
-
.should($el => {
|
|
16
|
-
expect($el[0].getDomRef()).to.exist;
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
cy.get("[ui5-test-parent]")
|
|
20
|
-
.as("testParent")
|
|
21
|
-
.then(el => {
|
|
22
|
-
cy.spy<UI5Element>((el.get(0) as UI5Element), "onInvalidation").as("invalidations");
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
cy.get("[ui5-test-child]")
|
|
26
|
-
.invoke("prop", "prop1", "a");
|
|
27
|
-
|
|
28
|
-
cy.get("@invalidations")
|
|
29
|
-
.should("have.been.called");
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
it("Tests that changing a non-monitored property of a child does not invalidate the parent", () => {
|
|
33
|
-
cy.mount(
|
|
34
|
-
<Parent>
|
|
35
|
-
<Child></Child>
|
|
36
|
-
</Parent>
|
|
37
|
-
);
|
|
38
|
-
|
|
39
|
-
cy.get<Parent>("[ui5-test-parent]")
|
|
40
|
-
.should($el => {
|
|
41
|
-
expect($el[0].getDomRef()).to.exist;
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
cy.get("[ui5-test-parent]")
|
|
45
|
-
.as("testParent")
|
|
46
|
-
.then(el => {
|
|
47
|
-
cy.spy<UI5Element>((el.get(0) as UI5Element), "onInvalidation").as("invalidations");
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
cy.get("[ui5-test-child]")
|
|
51
|
-
.invoke("prop", "prop2", "b");
|
|
52
|
-
|
|
53
|
-
cy.get("@invalidations")
|
|
54
|
-
.should("have.not.been.called");
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
it("Tests that changing a non-monitored property of a child does not invalidate the parent", () => {
|
|
58
|
-
cy.mount(
|
|
59
|
-
<Parent>
|
|
60
|
-
<Child slot="items"></Child>
|
|
61
|
-
</Parent>
|
|
62
|
-
);
|
|
63
|
-
|
|
64
|
-
cy.get<Parent>("[ui5-test-parent]")
|
|
65
|
-
.should($el => {
|
|
66
|
-
expect($el[0].getDomRef()).to.exist;
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
cy.get("[ui5-test-parent]")
|
|
70
|
-
.as("testParent")
|
|
71
|
-
.then(el => {
|
|
72
|
-
cy.spy<UI5Element>((el.get(0) as UI5Element), "onInvalidation").as("invalidations");
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
cy.get("[ui5-test-child]")
|
|
76
|
-
.invoke("prop", "prop1", "a")
|
|
77
|
-
.invoke("prop", "prop2", "b")
|
|
78
|
-
.invoke("prop", "prop3", "c");
|
|
79
|
-
|
|
80
|
-
cy.get("@invalidations")
|
|
81
|
-
.should("have.been.calledThrice");
|
|
82
|
-
});
|
|
83
|
-
});
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import type UI5Element from "../../src/UI5Element.js";
|
|
2
|
-
import GenericExt from "../../test/test-elements/GenericExt.js";
|
|
3
|
-
|
|
4
|
-
describe("Invalidation works", () => {
|
|
5
|
-
it("Tests that changing a monitored property of a child invalidates the parent", () => {
|
|
6
|
-
cy.mount(<GenericExt></GenericExt>);
|
|
7
|
-
|
|
8
|
-
cy.get("[ui5-test-generic-ext]")
|
|
9
|
-
.then($el => {
|
|
10
|
-
return ($el.get(0).constructor as typeof UI5Element).getMetadata();
|
|
11
|
-
})
|
|
12
|
-
.as("metadata");
|
|
13
|
-
|
|
14
|
-
cy.get("@metadata")
|
|
15
|
-
.invoke("getProperties")
|
|
16
|
-
.its("strProp")
|
|
17
|
-
.should("exist");
|
|
18
|
-
|
|
19
|
-
cy.get("@metadata")
|
|
20
|
-
.invoke("getProperties")
|
|
21
|
-
.its("extProp")
|
|
22
|
-
.should("exist");
|
|
23
|
-
|
|
24
|
-
cy.get("@metadata")
|
|
25
|
-
.invoke("getSlots")
|
|
26
|
-
.its("default")
|
|
27
|
-
.should("exist");
|
|
28
|
-
|
|
29
|
-
cy.get("@metadata")
|
|
30
|
-
.invoke("getSlots")
|
|
31
|
-
.its("extSlot")
|
|
32
|
-
.should("exist");
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
it("When extending metadata, property defaultValue can be modified", () => {
|
|
36
|
-
cy.mount(<GenericExt></GenericExt>);
|
|
37
|
-
|
|
38
|
-
cy.get("[ui5-test-generic-ext]")
|
|
39
|
-
.invoke("attr", "str-prop")
|
|
40
|
-
.should("equal", "Ext");
|
|
41
|
-
});
|
|
42
|
-
});
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import Generic from "../../test/test-elements/Generic.js";
|
|
2
|
-
|
|
3
|
-
describe("Properties can only have values, restricted to their types", () => {
|
|
4
|
-
it("String property enforced to string", () => {
|
|
5
|
-
cy.mount(<Generic></Generic>);
|
|
6
|
-
|
|
7
|
-
cy.get("[ui5-test-generic]")
|
|
8
|
-
.as("testGeneric");
|
|
9
|
-
|
|
10
|
-
cy.get("@testGeneric")
|
|
11
|
-
.invoke("prop", "strProp", 5);
|
|
12
|
-
|
|
13
|
-
cy.get("@testGeneric")
|
|
14
|
-
.should("have.prop", "strProp", 5);
|
|
15
|
-
});
|
|
16
|
-
});
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import Generic from "../../test/test-elements/Generic.js";
|
|
2
|
-
|
|
3
|
-
describe("Properties and attributes convert to each other", () => {
|
|
4
|
-
it("Tests that properties with default values are initialized with the default value", () => {
|
|
5
|
-
cy.mount(<Generic></Generic>);
|
|
6
|
-
|
|
7
|
-
cy.get("[ui5-test-generic]")
|
|
8
|
-
.as("testGeneric");
|
|
9
|
-
|
|
10
|
-
cy.get("@testGeneric")
|
|
11
|
-
.invoke("prop", "defaultValueProp")
|
|
12
|
-
.should("equal", "Hello");
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
it("Tests that prop-attr conversion works for string properties", () => {
|
|
16
|
-
cy.mount(<Generic></Generic>);
|
|
17
|
-
|
|
18
|
-
cy.get("[ui5-test-generic]")
|
|
19
|
-
.as("testGeneric");
|
|
20
|
-
|
|
21
|
-
cy.get("@testGeneric")
|
|
22
|
-
.invoke("prop", "strProp", "test1");
|
|
23
|
-
|
|
24
|
-
cy.get("@testGeneric")
|
|
25
|
-
.should("have.attr", "str-prop", "test1");
|
|
26
|
-
|
|
27
|
-
cy.get("@testGeneric")
|
|
28
|
-
.invoke("attr", "str-prop", "test2");
|
|
29
|
-
|
|
30
|
-
cy.get("@testGeneric")
|
|
31
|
-
.invoke("prop", "strProp")
|
|
32
|
-
.should("equal", "test2");
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
it("Tests that prop-attr conversion works for boolean properties", () => {
|
|
36
|
-
cy.mount(<Generic></Generic>);
|
|
37
|
-
|
|
38
|
-
cy.get("[ui5-test-generic]")
|
|
39
|
-
.as("testGeneric");
|
|
40
|
-
|
|
41
|
-
cy.get("@testGeneric")
|
|
42
|
-
.invoke("prop", "boolProp", true);
|
|
43
|
-
|
|
44
|
-
cy.get("@testGeneric")
|
|
45
|
-
.should("have.attr", "bool-prop");
|
|
46
|
-
|
|
47
|
-
cy.get("@testGeneric")
|
|
48
|
-
.invoke("prop", "boolProp", false);
|
|
49
|
-
|
|
50
|
-
cy.get("@testGeneric")
|
|
51
|
-
.should("not.have.attr", "bool-prop");
|
|
52
|
-
|
|
53
|
-
cy.get("@testGeneric")
|
|
54
|
-
.invoke("attr", "bool-prop", true);
|
|
55
|
-
|
|
56
|
-
cy.get("@testGeneric")
|
|
57
|
-
.invoke("prop", "boolProp")
|
|
58
|
-
.should("be.true");
|
|
59
|
-
|
|
60
|
-
cy.get("@testGeneric")
|
|
61
|
-
.invoke("removeAttr", "bool-prop");
|
|
62
|
-
|
|
63
|
-
cy.get("@testGeneric")
|
|
64
|
-
.invoke("prop", "boolProp")
|
|
65
|
-
.should("be.false");
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
it("Tests that object properties have no attributes", () => {
|
|
69
|
-
cy.mount(<Generic></Generic>);
|
|
70
|
-
|
|
71
|
-
cy.get("[ui5-test-generic]")
|
|
72
|
-
.as("testGeneric");
|
|
73
|
-
|
|
74
|
-
cy.get("@testGeneric")
|
|
75
|
-
.invoke("prop", "objectProp", {});
|
|
76
|
-
|
|
77
|
-
cy.get("@testGeneric")
|
|
78
|
-
.should("not.have.attr", "object-prop");
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
it("Tests that array properties have no attributes", () => {
|
|
82
|
-
cy.mount(<Generic></Generic>);
|
|
83
|
-
|
|
84
|
-
cy.get("[ui5-test-generic]")
|
|
85
|
-
.as("testGeneric");
|
|
86
|
-
|
|
87
|
-
cy.get("@testGeneric")
|
|
88
|
-
.invoke("prop", "multiProp", ["a", "b"]);
|
|
89
|
-
|
|
90
|
-
cy.get("@testGeneric")
|
|
91
|
-
.should("not.have.attr", "multi-prop");
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
it("Tests that noAttribute properties have no attributes", () => {
|
|
95
|
-
cy.mount(<Generic></Generic>);
|
|
96
|
-
|
|
97
|
-
cy.get("[ui5-test-generic]")
|
|
98
|
-
.as("testGeneric");
|
|
99
|
-
|
|
100
|
-
cy.get("@testGeneric")
|
|
101
|
-
.invoke("prop", "noAttributeProp", "some value");
|
|
102
|
-
|
|
103
|
-
cy.get("@testGeneric")
|
|
104
|
-
.should("not.have.attr", "no-attribute-prop");
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
it("Tests that properties with default values do automatically set attributes", () => {
|
|
108
|
-
cy.mount(<Generic></Generic>);
|
|
109
|
-
|
|
110
|
-
cy.get("[ui5-test-generic]")
|
|
111
|
-
.should("have.attr", "default-value-prop", "Hello");
|
|
112
|
-
});
|
|
113
|
-
});
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import Generic from "../../test/test-elements/Generic.js";
|
|
2
|
-
import NoShadowDOM from "../../test/test-elements/NoShadowDOM.js";
|
|
3
|
-
|
|
4
|
-
describe("The framework can define web components", () => {
|
|
5
|
-
it("Tests that element's Shadow DOM is rendered if it has a template", () => {
|
|
6
|
-
cy.mount(<Generic></Generic>);
|
|
7
|
-
|
|
8
|
-
cy.get("[ui5-test-generic]")
|
|
9
|
-
.as("testGeneric")
|
|
10
|
-
.then($element => {
|
|
11
|
-
return !!$element.get(0).shadowRoot;
|
|
12
|
-
})
|
|
13
|
-
.should("be.true");
|
|
14
|
-
|
|
15
|
-
cy.get("@testGeneric")
|
|
16
|
-
.shadow()
|
|
17
|
-
.find("div > p")
|
|
18
|
-
.should("exist");
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
it("Tests that element's Shadow DOM is not rendered if it has no template", () => {
|
|
22
|
-
cy.mount(<NoShadowDOM></NoShadowDOM>);
|
|
23
|
-
|
|
24
|
-
cy.get("[ui5-test-no-shadow]")
|
|
25
|
-
.then($element => {
|
|
26
|
-
return !!$element.get(0).shadowRoot;
|
|
27
|
-
})
|
|
28
|
-
.should("be.false");
|
|
29
|
-
});
|
|
30
|
-
});
|
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
import Generic from "../../test/test-elements/Generic.js";
|
|
2
|
-
|
|
3
|
-
describe("Slots work properly", () => {
|
|
4
|
-
it("Tests that properties exist on the element for each slot", () => {
|
|
5
|
-
cy.mount(
|
|
6
|
-
<Generic>
|
|
7
|
-
Default slot text
|
|
8
|
-
<span>Default slot content</span>
|
|
9
|
-
<span slot="other">Other slot content 1</span>
|
|
10
|
-
<span slot="other">Other slot content 2</span>
|
|
11
|
-
<span slot="individual">Individual slot content 1</span>
|
|
12
|
-
<span slot="individual">Individual slot content 2</span>
|
|
13
|
-
<span slot="named">Item in slot with propertyName</span>
|
|
14
|
-
<span slot="named">Item in slot with propertyName</span>
|
|
15
|
-
<span slot="row-header">Item in slot row-header</span>
|
|
16
|
-
<span slot="row-header">Item in slot row-header</span>
|
|
17
|
-
</Generic>
|
|
18
|
-
);
|
|
19
|
-
|
|
20
|
-
cy.get<Generic>("[ui5-test-generic]")
|
|
21
|
-
.should($el => {
|
|
22
|
-
expect($el[0].getDomRef()).to.exist;
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
cy.get("[ui5-test-generic]")
|
|
26
|
-
.as("testGeneric");
|
|
27
|
-
|
|
28
|
-
cy.get("@testGeneric")
|
|
29
|
-
.invoke("prop", "content")
|
|
30
|
-
.then(value => {
|
|
31
|
-
return (value as Array<unknown>).length;
|
|
32
|
-
})
|
|
33
|
-
.should("be.greaterThan", 0);
|
|
34
|
-
|
|
35
|
-
cy.get("@testGeneric")
|
|
36
|
-
.invoke("prop", "other")
|
|
37
|
-
.should("have.length", 2);
|
|
38
|
-
|
|
39
|
-
cy.get("@testGeneric")
|
|
40
|
-
.invoke("prop", "individual")
|
|
41
|
-
.should("have.length", 2);
|
|
42
|
-
|
|
43
|
-
cy.get("@testGeneric")
|
|
44
|
-
.invoke("prop", "row-header")
|
|
45
|
-
.should("have.length", 2);
|
|
46
|
-
|
|
47
|
-
cy.get("@testGeneric")
|
|
48
|
-
.invoke("prop", "named")
|
|
49
|
-
.should("be.undefined");
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
it("Tests that properties exist on the element for each slot", () => {
|
|
53
|
-
cy.mount(
|
|
54
|
-
<Generic>
|
|
55
|
-
<span slot="individual">Individual slot content 1</span>
|
|
56
|
-
<span slot="individual">Individual slot content 2</span>
|
|
57
|
-
</Generic>
|
|
58
|
-
);
|
|
59
|
-
|
|
60
|
-
cy.get<Generic>("[ui5-test-generic]")
|
|
61
|
-
.should($el => {
|
|
62
|
-
expect($el[0].getDomRef()).to.exist;
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
cy.get("[ui5-test-generic]");
|
|
66
|
-
|
|
67
|
-
cy.get("[slot=individual]")
|
|
68
|
-
.should("not.exist");
|
|
69
|
-
|
|
70
|
-
cy.get("[slot=individual-1]")
|
|
71
|
-
.should("exist");
|
|
72
|
-
|
|
73
|
-
cy.get("[slot=individual-2]")
|
|
74
|
-
.should("exist");
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
it("Tests that changing the slot attribute of children redistributes them across slot accessors", () => {
|
|
78
|
-
let defaultSlotLength = 0;
|
|
79
|
-
|
|
80
|
-
cy.mount(
|
|
81
|
-
<Generic>
|
|
82
|
-
<span>Default slot content</span>
|
|
83
|
-
<span slot="other" id="o1">Other slot content 1</span>
|
|
84
|
-
<span slot="other" id="o2">Other slot content 2</span>
|
|
85
|
-
<span slot="named">Item in slot with propertyName</span>
|
|
86
|
-
<span slot="named">Item in slot with propertyName</span>
|
|
87
|
-
</Generic>
|
|
88
|
-
);
|
|
89
|
-
|
|
90
|
-
cy.get<Generic>("[ui5-test-generic]")
|
|
91
|
-
.should($el => {
|
|
92
|
-
expect($el[0].getDomRef()).to.exist;
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
cy.get("[ui5-test-generic]")
|
|
96
|
-
.as("testGeneric");
|
|
97
|
-
|
|
98
|
-
cy.get("@testGeneric")
|
|
99
|
-
.invoke("prop", "content")
|
|
100
|
-
.then(value => {
|
|
101
|
-
defaultSlotLength = value.length;
|
|
102
|
-
|
|
103
|
-
return defaultSlotLength;
|
|
104
|
-
})
|
|
105
|
-
.should("be.greaterThan", 0);
|
|
106
|
-
|
|
107
|
-
cy.get("@testGeneric")
|
|
108
|
-
.invoke("prop", "other")
|
|
109
|
-
.should("have.length", 2);
|
|
110
|
-
|
|
111
|
-
cy.get("@testGeneric")
|
|
112
|
-
.invoke("prop", "items")
|
|
113
|
-
.should("have.length", 2);
|
|
114
|
-
|
|
115
|
-
cy.get("#o1")
|
|
116
|
-
.invoke("removeAttr", "slot");
|
|
117
|
-
|
|
118
|
-
cy.get("#o2")
|
|
119
|
-
.invoke("attr", "slot", "named");
|
|
120
|
-
|
|
121
|
-
cy.get("@testGeneric")
|
|
122
|
-
.then($testGeneric => {
|
|
123
|
-
cy.wrap($testGeneric)
|
|
124
|
-
.invoke("prop", "content")
|
|
125
|
-
.should("have.length", defaultSlotLength + 1);
|
|
126
|
-
});
|
|
127
|
-
|
|
128
|
-
cy.get("@testGeneric")
|
|
129
|
-
.invoke("prop", "other")
|
|
130
|
-
.should("have.length", 0);
|
|
131
|
-
|
|
132
|
-
cy.get("@testGeneric")
|
|
133
|
-
.invoke("prop", "items")
|
|
134
|
-
.should("have.length", 3);
|
|
135
|
-
});
|
|
136
|
-
});
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import WithComplexTemplate from "../../test/test-elements/WithComplexTemplate.js";
|
|
2
|
-
|
|
3
|
-
describe("Complex templates", () => {
|
|
4
|
-
it("Tests context maintained in the HBS template before, after and inside 'each' statements", () => {
|
|
5
|
-
const EXPTECTED_LOOP_CONTENT = "Root text: root, Item text: positives";
|
|
6
|
-
const EXPTECTED_NESTED_LOOP_CONTENT = "Root Text: root, Word text: word1_good";
|
|
7
|
-
|
|
8
|
-
cy.mount(<WithComplexTemplate />);
|
|
9
|
-
|
|
10
|
-
cy.get("[ui5-test-complex-template]")
|
|
11
|
-
.shadow()
|
|
12
|
-
.find(".before-each-content--start--0")
|
|
13
|
-
.should("have.text", EXPTECTED_LOOP_CONTENT);
|
|
14
|
-
|
|
15
|
-
cy.get("[ui5-test-complex-template]")
|
|
16
|
-
.shadow()
|
|
17
|
-
.find(".nested-each-content--0--0")
|
|
18
|
-
.first()
|
|
19
|
-
.should("have.text", EXPTECTED_NESTED_LOOP_CONTENT);
|
|
20
|
-
|
|
21
|
-
cy.get("[ui5-test-complex-template]")
|
|
22
|
-
.shadow()
|
|
23
|
-
.find(".nested-each-content--0--1")
|
|
24
|
-
.first()
|
|
25
|
-
.should("have.text", EXPTECTED_NESTED_LOOP_CONTENT);
|
|
26
|
-
|
|
27
|
-
cy.get("[ui5-test-complex-template]")
|
|
28
|
-
.shadow()
|
|
29
|
-
.find(".after-each-content--end--0")
|
|
30
|
-
.should("have.text", EXPTECTED_LOOP_CONTENT);
|
|
31
|
-
});
|
|
32
|
-
});
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
import { setLanguage } from "../../src/config/Language.js";
|
|
2
|
-
import { registerI18nLoader, getI18nBundle } from "../../src/i18nBundle.js";
|
|
3
|
-
import parseProperties from "../../src/PropertiesFileFormat.js";
|
|
4
|
-
import I18nParent from "../../test/test-elements/I18nParent.js";
|
|
5
|
-
import I18nChild from "../../test/test-elements/I18nChild.js";
|
|
6
|
-
import I18nChild2 from "../../test/test-elements/I18nChild2.js";
|
|
7
|
-
|
|
8
|
-
const props = `PLEASE_WAIT=Patientez.
|
|
9
|
-
TEST_1=Text '{0}
|
|
10
|
-
TEST_2=Text ''{0}
|
|
11
|
-
TEST_3=Text ''{0}''
|
|
12
|
-
TEST_4=Text
|
|
13
|
-
TEST_5=Text '
|
|
14
|
-
TEST_6=Text ''
|
|
15
|
-
TEST_7=Text {0}
|
|
16
|
-
TEST_8=Text '{0}'
|
|
17
|
-
TEST_9=Text '{0}''`;
|
|
18
|
-
|
|
19
|
-
const texts = [
|
|
20
|
-
{ key: "TEST_1", result: "Text {0}" },
|
|
21
|
-
{ key: "TEST_2", result: "Text 'test" },
|
|
22
|
-
{ key: "TEST_3", result: "Text 'test'" },
|
|
23
|
-
{ key: "TEST_4", result: "Text" },
|
|
24
|
-
{ key: "TEST_5", result: "Text '" },
|
|
25
|
-
{ key: "TEST_6", result: "Text '" },
|
|
26
|
-
{ key: "TEST_7", result: "Text test" },
|
|
27
|
-
{ key: "TEST_8", result: "Text {0}" },
|
|
28
|
-
{ key: "TEST_9", result: "Text {0}'" }
|
|
29
|
-
];
|
|
30
|
-
|
|
31
|
-
describe("i18n texts", () => {
|
|
32
|
-
beforeEach(() => {
|
|
33
|
-
cy.wrap({ setLanguage, registerI18nLoader, getI18nBundle })
|
|
34
|
-
.then(async api => {
|
|
35
|
-
// eslint-disable-next-line @typescript-eslint/require-await
|
|
36
|
-
api.registerI18nLoader("myApp", "fr", async () => {
|
|
37
|
-
return parseProperties(props);
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
await api.setLanguage("fr");
|
|
41
|
-
});
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
it("Getting text from current language", () => {
|
|
45
|
-
cy.wrap({ getI18nBundle })
|
|
46
|
-
.then(async api => {
|
|
47
|
-
const bundle = await api.getI18nBundle("myApp");
|
|
48
|
-
|
|
49
|
-
return bundle.getText("PLEASE_WAIT");
|
|
50
|
-
})
|
|
51
|
-
.should("equal", "Patientez.");
|
|
52
|
-
|
|
53
|
-
cy.wrap({ setLanguage })
|
|
54
|
-
.then(async api => {
|
|
55
|
-
await api.setLanguage("bg");
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
cy.wrap({ getI18nBundle })
|
|
59
|
-
.then(async api => {
|
|
60
|
-
const bundle = await api.getI18nBundle("myApp");
|
|
61
|
-
|
|
62
|
-
return bundle.getText("PLEASE_WAIT");
|
|
63
|
-
})
|
|
64
|
-
.should("equal", "PLEASE_WAIT");
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
// Single quote ' escape some symbols after it. For example: "Text '{0}" will result in "Text {0}". To use single
|
|
68
|
-
// quote you have to use: ''
|
|
69
|
-
it("Single quote '", () => {
|
|
70
|
-
texts.forEach(textData => {
|
|
71
|
-
cy.wrap({ getI18nBundle })
|
|
72
|
-
.then(async api => {
|
|
73
|
-
const bundle = await api.getI18nBundle("myApp");
|
|
74
|
-
|
|
75
|
-
return bundle.getText(textData.key, "test");
|
|
76
|
-
})
|
|
77
|
-
.should("equal", textData.result);
|
|
78
|
-
});
|
|
79
|
-
});
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
describe("i18n decorator", () => {
|
|
83
|
-
beforeEach(() => {
|
|
84
|
-
cy.wrap({ setLanguage, registerI18nLoader })
|
|
85
|
-
.then(async api => {
|
|
86
|
-
// eslint-disable-next-line @typescript-eslint/require-await
|
|
87
|
-
api.registerI18nLoader("custom-language", "bg", async () => {
|
|
88
|
-
return parseProperties(`PLEASE_WAIT=Моля изчакайте`);
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
// eslint-disable-next-line @typescript-eslint/require-await
|
|
92
|
-
api.registerI18nLoader("another-custom-language", "bg", async () => {
|
|
93
|
-
return parseProperties(`SOME_KEY=Някакъв ключ`);
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
await api.setLanguage("bg");
|
|
97
|
-
});
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
it("Bundle is accessed from every class", () => {
|
|
101
|
-
cy.mount(<>
|
|
102
|
-
<I18nParent />
|
|
103
|
-
<I18nChild />
|
|
104
|
-
</>);
|
|
105
|
-
|
|
106
|
-
cy.get("[i18n-parent]")
|
|
107
|
-
.invoke("prop", "i18nText")
|
|
108
|
-
.should("be.equal", "Моля изчакайте");
|
|
109
|
-
|
|
110
|
-
cy.get("[i18n-child]")
|
|
111
|
-
.invoke("prop", "i18nText")
|
|
112
|
-
.should("be.equal", "Моля изчакайте");
|
|
113
|
-
});
|
|
114
|
-
|
|
115
|
-
it("Bundle storage works correctly", () => {
|
|
116
|
-
cy.mount(<>
|
|
117
|
-
<I18nParent />
|
|
118
|
-
<I18nChild2 />
|
|
119
|
-
</>);
|
|
120
|
-
|
|
121
|
-
cy.get("[i18n-parent]")
|
|
122
|
-
.invoke("prop", "i18nText")
|
|
123
|
-
.should("be.equal", "Моля изчакайте");
|
|
124
|
-
|
|
125
|
-
cy.get("[i18n-child2]")
|
|
126
|
-
.invoke("prop", "i18nText")
|
|
127
|
-
.should("be.equal", "Някакъв ключ");
|
|
128
|
-
});
|
|
129
|
-
});
|