@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.
Files changed (38) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/.tsbuildinfobuild +1 -1
  3. package/dist/features/OpenUI5Support.d.ts +1 -0
  4. package/dist/features/OpenUI5Support.js +30 -27
  5. package/dist/features/OpenUI5Support.js.map +1 -1
  6. package/dist/generated/VersionInfo.js +3 -3
  7. package/dist/generated/VersionInfo.js.map +1 -1
  8. package/dist/prod/features/OpenUI5Support.js +1 -1
  9. package/dist/prod/features/OpenUI5Support.js.map +2 -2
  10. package/dist/prod/generated/VersionInfo.js +1 -1
  11. package/dist/prod/generated/VersionInfo.js.map +1 -1
  12. package/package.json +3 -3
  13. package/cypress/specs/Accessor.cy.tsx +0 -79
  14. package/cypress/specs/Boot.cy.tsx +0 -19
  15. package/cypress/specs/ConfigurationChange.cy.tsx +0 -41
  16. package/cypress/specs/ConfigurationScript.cy.tsx +0 -133
  17. package/cypress/specs/ConfigurationURL.cy.tsx +0 -201
  18. package/cypress/specs/CustomMount.cy.tsx +0 -9
  19. package/cypress/specs/CustomTheme.cy.tsx +0 -36
  20. package/cypress/specs/EventProvider.cy.tsx +0 -59
  21. package/cypress/specs/Events.cy.tsx +0 -28
  22. package/cypress/specs/SystemDOMElements.cy.tsx +0 -8
  23. package/cypress/specs/Theming.cy.tsx +0 -74
  24. package/cypress/specs/UI5ElementInvalidation.cy.tsx +0 -252
  25. package/cypress/specs/UI5ElementLifecycle.cy.tsx +0 -82
  26. package/cypress/specs/UI5ElementListenForChildPropChanges.cy.tsx +0 -83
  27. package/cypress/specs/UI5ElementMetadataExt.cy.tsx +0 -42
  28. package/cypress/specs/UI5ElementPropertyValidation.cy.tsx +0 -16
  29. package/cypress/specs/UI5ElementPropsAndAttrs.cy.tsx +0 -113
  30. package/cypress/specs/UI5ElementShadowDOM.cy.tsx +0 -30
  31. package/cypress/specs/UI5ElementSlots.cy.tsx +0 -136
  32. package/cypress/specs/WithComplexTemplate.cy.tsx +0 -32
  33. package/cypress/specs/i18n_texts.cy.tsx +0 -129
  34. package/cypress/specs/util/FocusableElements.cy.tsx +0 -48
  35. package/cypress/support/commands.ts +0 -39
  36. package/cypress/support/component-index.html +0 -12
  37. package/cypress/support/component.ts +0 -17
  38. package/cypress/tsconfig.json +0 -21
@@ -1,201 +0,0 @@
1
- import { internals } from "../../src/Location.js";
2
- import TestGeneric from "../../test/test-elements/Generic.js";
3
- import { resetConfiguration } from "../../src/InitialConfiguration.js";
4
- import { getLanguage } from "../../src/config/Language.js";
5
- import { getCalendarType } from "../../src/config/CalendarType.js";
6
- import { getTheme } from "../../src/config/Theme.js";
7
- import { getAnimationMode } from "../../src/config/AnimationMode.js";
8
- import AnimationMode from "../../src/types/AnimationMode.js";
9
- import { getThemeRoot } from "../../src/config/ThemeRoot.js";
10
-
11
- describe("Some settings can be set via SAP UI URL params", () => {
12
- before(() => {
13
- const searchParams = "sap-ui-rtl=true&sap-ui-language=ja&sap-ui-calendarType=Japanese&sap-ui-theme=sap_horizon_hcb&sap-ui-animationMode=basic";
14
-
15
- cy.stub(internals, "search", () => {
16
- return searchParams;
17
- });
18
-
19
- cy.then(() => {
20
- return resetConfiguration(true);
21
- });
22
-
23
- cy.wrap(internals)
24
- .invoke("search")
25
- .should("be.equal", searchParams);
26
-
27
- cy.mount(<TestGeneric />);
28
- });
29
-
30
- it("Tests that language is applied", () => {
31
- cy.wrap({ getLanguage })
32
- .invoke("getLanguage")
33
- .should("equal", "ja");
34
- });
35
-
36
- it("Tests that calendarType is applied", () => {
37
- cy.wrap({ getCalendarType })
38
- .invoke("getCalendarType")
39
- .should("equal", "Japanese");
40
- });
41
-
42
- it("Tests that theme is applied", () => {
43
- cy.wrap({ getTheme })
44
- .invoke("getTheme")
45
- .should("equal", "sap_horizon_hcb");
46
- });
47
-
48
- it("Tests that animationMode is applied", () => {
49
- cy.wrap({ getAnimationMode })
50
- .invoke("getAnimationMode")
51
- .should("equal", AnimationMode.Basic);
52
- });
53
- });
54
-
55
- describe("Different themeRoot configurations", () => {
56
- it("Allowed theme root", () => {
57
- const searchParams = "sap-ui-theme=sap_horizon_hcb@https://example.com";
58
-
59
- // All allowed theme roots need to be described inside the meta tag.
60
- cy.window()
61
- .then($el => {
62
- const metaTag = document.createElement("meta");
63
- metaTag.name = "sap-allowedThemeOrigins";
64
- metaTag.content = "https://example.com";
65
-
66
- $el.document.head.append(metaTag);
67
- })
68
-
69
- cy.stub(internals, "search", () => {
70
- return searchParams;
71
- });
72
-
73
- cy.wrap({ resetConfiguration })
74
- .invoke("resetConfiguration", true);
75
-
76
- cy.wrap(internals)
77
- .invoke("search")
78
- .should("be.equal", searchParams);
79
-
80
- cy.mount(<TestGeneric />);
81
-
82
- cy.wrap({ getThemeRoot })
83
- .invoke("getThemeRoot")
84
- .should("equal", "https://example.com/UI5/");
85
-
86
- // All allowed theme roots need to be described inside the meta tag.
87
- cy.window()
88
- .then($el => {
89
- const metaTag = $el.document.head.querySelector("[name='sap-allowedThemeOrigins']");
90
-
91
- metaTag?.remove();
92
- })
93
- });
94
-
95
- it("Unallowed theme root", () => {
96
- const searchParams = "sap-ui-theme=sap_horizon_hcb@https://another-example.com";
97
-
98
- cy.stub(internals, "search", () => {
99
- return searchParams;
100
- });
101
-
102
- cy.wrap({ resetConfiguration })
103
- .invoke("resetConfiguration", true);
104
-
105
- cy.wrap(internals)
106
- .invoke("search")
107
- .should("be.equal", searchParams);
108
-
109
- cy.mount(<TestGeneric />);
110
-
111
- cy.wrap({ getThemeRoot })
112
- .invoke("getThemeRoot")
113
- .should("equal", `${window.location.origin}/UI5/`);
114
- });
115
-
116
- it("Relative theme root", () => {
117
- const searchParams = "sap-ui-theme=sap_horizon_hcb@./test";
118
-
119
- cy.stub(internals, "search", () => {
120
- return searchParams;
121
- });
122
-
123
- cy.wrap({ resetConfiguration })
124
- .invoke("resetConfiguration", true);
125
-
126
- cy.wrap(internals)
127
- .invoke("search")
128
- .should("be.equal", searchParams);
129
-
130
- cy.mount(<TestGeneric />);
131
-
132
- cy.wrap({ getThemeRoot })
133
- .invoke("getThemeRoot")
134
- .then(themeRoot => {
135
- return themeRoot?.endsWith("/test/UI5/");
136
- })
137
- .should("be.true");
138
- });
139
- });
140
-
141
- describe("Some settings can be set via SAP URL params", () => {
142
- before(() => {
143
- const searchParams = "sap-language=bg&sap-theme=sap_fiori_3_dark";
144
-
145
- cy.stub(internals, "search", () => {
146
- return searchParams;
147
- });
148
-
149
- cy.wrap({ resetConfiguration })
150
- .invoke("resetConfiguration", true);
151
-
152
- cy.wrap(internals)
153
- .invoke("search")
154
- .should("be.equal", searchParams);
155
-
156
- cy.mount(<TestGeneric />);
157
- });
158
-
159
- it("Tests that language is applied via sap-ui-language", () => {
160
- cy.wrap({ getLanguage })
161
- .invoke("getLanguage")
162
- .should("equal", "bg");
163
- });
164
-
165
- it("Tests that theme is applied via sap-ui-theme", () => {
166
- cy.wrap({ getTheme })
167
- .invoke("getTheme")
168
- .should("equal", "sap_fiori_3_dark");
169
- });
170
- });
171
-
172
- describe("Some settings can be set via SAP UI URL params", () => {
173
- before(() => {
174
- const searchParams = "sap-language=bg&sap-ui-language=de&sap-theme=sap_fiori_3_dark&sap-theme=sap_fiori_3_hcb";
175
-
176
- cy.stub(internals, "search", () => {
177
- return searchParams;
178
- });
179
-
180
- cy.wrap({ resetConfiguration })
181
- .invoke("resetConfiguration", true);
182
-
183
- cy.wrap(internals)
184
- .invoke("search")
185
- .should("be.equal", searchParams);
186
-
187
- cy.mount(<TestGeneric />);
188
- });
189
-
190
- it("Tests that language is applied via sap-ui-language", () => {
191
- cy.wrap({ getLanguage })
192
- .invoke("getLanguage")
193
- .should("equal", "de");
194
- });
195
-
196
- it("Tests that theme is applied via sap-ui-theme", () => {
197
- cy.wrap({ getTheme })
198
- .invoke("getTheme")
199
- .should("equal", "sap_fiori_3_hcb");
200
- });
201
- });
@@ -1,9 +0,0 @@
1
- describe("Custom mount", () => {
2
- it("mount", () => {
3
- cy.mount(<button>Test</button>);
4
-
5
- cy.get("button")
6
- .should("exist")
7
- .and("have.text", "Test");
8
- });
9
- });
@@ -1,36 +0,0 @@
1
- import { registerThemePropertiesLoader } from "../../src/AssetRegistry.js";
2
- import { setTheme } from "../../src/config/Theme.js";
3
- import { getCurrentRuntimeIndex } from "../../src/Runtimes.js";
4
- import TestGeneric from "../../test/test-elements/Generic.js";
5
-
6
- describe("Custom themes can be registered", () => {
7
- it("Tests that theme parameters are changed on theme change", () => {
8
- const newTheme = "my_custom_theme";
9
- const var1 = "--var1: #555555";
10
- const currentRuntime = 0;
11
- const dataPropAttr = `data-ui5-component-properties-${currentRuntime}`;
12
-
13
- cy.mount(<TestGeneric />);
14
-
15
- cy.wrap({ getCurrentRuntimeIndex })
16
- .invoke("getCurrentRuntimeIndex")
17
- .should("equal", currentRuntime);
18
-
19
- cy.wrap({ registerThemePropertiesLoader })
20
- .invoke("registerThemePropertiesLoader", "@ui5/webcomponents-base-test", newTheme, () => Promise.resolve(`:root{ ${var1}; }`));
21
-
22
- cy.wrap({ setTheme })
23
- .invoke("setTheme", newTheme);
24
-
25
- cy.document()
26
- .its("adoptedStyleSheets")
27
- .then(adoptedStyleSheets => {
28
- // eslint-disable-next-line
29
- return adoptedStyleSheets.find(sh => (sh as Record<string, any>)._ui5StyleId === `${dataPropAttr}|@ui5/webcomponents-base-test`);
30
- })
31
- .its("cssRules")
32
- .its(0)
33
- .its("cssText")
34
- .should("include", var1);
35
- });
36
- });
@@ -1,59 +0,0 @@
1
- import EventProvider from "../../src/EventProvider.js";
2
-
3
- describe("Event provider attaches and detaches listeners properly", () => {
4
- it("Tests that listeners can be removed (1 listener)", () => {
5
- let timesCalled = 0;
6
-
7
- cy.then(() => {
8
- const ep = new EventProvider();
9
- const callback = () => {
10
- timesCalled++;
11
- };
12
-
13
- // Setup
14
- ep.attachEvent("test", callback);
15
-
16
- // Act
17
- ep.fireEvent("test", undefined); // should execute the callback and increase the counter
18
-
19
- // Setup
20
- ep.detachEvent("test", callback);
21
-
22
- // Act
23
- ep.fireEvent("test", undefined); // should not execute the callback and increase the counter
24
- })
25
- .then(() => {
26
- return timesCalled;
27
- })
28
- .should("equal", 1);
29
- });
30
-
31
- it("Tests that listeners can be removed (more than 1 listener)", () => {
32
- let timesCalled = 0;
33
-
34
- cy.then(() => {
35
- const ep = new EventProvider();
36
- const callback = () => {
37
- timesCalled++;
38
- };
39
- const somePreviousCallback = () => { };
40
-
41
- // Setup
42
- ep.attachEvent("test", somePreviousCallback); // Attach something so that after detachEvent the listeners array is not empty!
43
- ep.attachEvent("test", callback);
44
-
45
- // Act
46
- ep.fireEvent("test", undefined); // should execute the callback and increase the counter
47
-
48
- // Setup
49
- ep.detachEvent("test", callback);
50
-
51
- // Act
52
- ep.fireEvent("test", undefined); // should not execute the callback and increase the counter
53
- })
54
- .then(() => {
55
- return timesCalled;
56
- })
57
- .should("equal", 1);
58
- });
59
- });
@@ -1,28 +0,0 @@
1
- import EventsConsumer from "../../test/test-elements/Events.js";
2
- import type { Events } from "../../test/test-elements/Events.js";
3
-
4
- describe("Event provider attaches and detaches listeners properly", () => {
5
- it("Tests that attaching camelCase and kebab-case events in templates works", () => {
6
- cy.mount(<EventsConsumer></EventsConsumer>);
7
- cy.get<EventsConsumer>("[ui5-test-events-consumer]")
8
- .as("eventsConsumer");
9
-
10
- cy.get("@eventsConsumer")
11
- .shadow()
12
- .find("[ui5-test-events]")
13
- .then(elements => {
14
- (elements[0] as Events).fireKebaCaseEvent();
15
- });
16
- cy.get("@eventsConsumer")
17
- .should("have.prop", "kebabCaseFired", true);
18
-
19
- cy.get("@eventsConsumer")
20
- .shadow()
21
- .find("[ui5-test-events]")
22
- .then(elements => {
23
- (elements[0] as Events).fireCamelCaseEvent();
24
- });
25
- cy.get("@eventsConsumer")
26
- .should("have.prop", "camelCaseFired", true);
27
- });
28
- });
@@ -1,8 +0,0 @@
1
- import "../../test/test-elements/Accessor.js";
2
-
3
- describe("Shared Resources", () => {
4
- it("Tests the presense of the shared resources 'meta' element", () => {
5
- cy.get(`meta[name="ui5-shared-resources"]`)
6
- .should("exist");
7
- });
8
- });
@@ -1,74 +0,0 @@
1
- import { setTheme } from "../../src/config/Theme.js";
2
- import { getCurrentRuntimeIndex } from "../../src/Runtimes.js";
3
- import "../../test/test-elements/Accessor.js";
4
- import "../../test/assets/Themes.js";
5
-
6
- describe("Theming works", () => {
7
- it("Tests that the parameters for the default theme are embedded on boot", () => {
8
- const currentRuntime = 0;
9
- const dataPropAttr = `data-ui5-component-properties-${currentRuntime}`;
10
-
11
- cy.wrap({ getCurrentRuntimeIndex })
12
- .invoke("getCurrentRuntimeIndex")
13
- .should("equal", currentRuntime);
14
-
15
- cy.document()
16
- .its("adoptedStyleSheets")
17
- .then(adoptedStyleSheets => {
18
- // eslint-disable-next-line
19
- return adoptedStyleSheets.find(sh => (sh as Record<string, any>)._ui5StyleId === `${dataPropAttr}|@ui5/webcomponents-base-test`);
20
- })
21
- .its("cssRules")
22
- .its(0)
23
- .its("cssText")
24
- .should("include", "--var1: grey");
25
- });
26
-
27
- it("Tests that the parameters for the default theme are embedded on boot", () => {
28
- const newTheme = "sap_fiori_3_hcb";
29
- const currentRuntime = 0;
30
- const dataPropAttr = `data-ui5-component-properties-${currentRuntime}`;
31
-
32
- cy.wrap({ getCurrentRuntimeIndex })
33
- .invoke("getCurrentRuntimeIndex")
34
- .should("equal", currentRuntime);
35
-
36
- cy.wrap({ setTheme })
37
- .invoke("setTheme", newTheme);
38
-
39
- cy.document()
40
- .its("adoptedStyleSheets")
41
- .then(adoptedStyleSheets => {
42
- // eslint-disable-next-line
43
- return adoptedStyleSheets.find(sh => (sh as Record<string, any>)._ui5StyleId === `${dataPropAttr}|@ui5/webcomponents-base-test`);
44
- })
45
- .its("cssRules")
46
- .its(0)
47
- .its("cssText")
48
- .should("include", "--var1: yellow");
49
- });
50
-
51
- it("Tests that the parameters for the default theme are embedded on boot", () => {
52
- const unknownTheme = "sap_unknown_theme";
53
- const currentRuntime = 0;
54
- const dataPropAttr = `data-ui5-component-properties-${currentRuntime}`;
55
-
56
- cy.wrap({ getCurrentRuntimeIndex })
57
- .invoke("getCurrentRuntimeIndex")
58
- .should("equal", currentRuntime);
59
-
60
- cy.wrap({ setTheme })
61
- .invoke("setTheme", unknownTheme);
62
-
63
- cy.document()
64
- .its("adoptedStyleSheets")
65
- .then(adoptedStyleSheets => {
66
- // eslint-disable-next-line
67
- return adoptedStyleSheets.find(sh => (sh as Record<string, any>)._ui5StyleId === `${dataPropAttr}|@ui5/webcomponents-base-test`);
68
- })
69
- .its("cssRules")
70
- .its(0)
71
- .its("cssText")
72
- .should("include", "--var1: grey");
73
- });
74
- });
@@ -1,252 +0,0 @@
1
- import type UI5Element from "../../src/UI5Element.js";
2
- import Generic from "../../test/test-elements/Generic.js";
3
-
4
- describe("Invalidation works", () => {
5
- it("Tests that changing a property invalidates", () => {
6
- cy.mount(<Generic></Generic>);
7
-
8
- cy.get<Generic>("[ui5-test-generic]")
9
- .should($el => {
10
- expect($el[0].getDomRef()).to.exist;
11
- });
12
-
13
- cy.get("[ui5-test-generic]")
14
- .as("testGeneric")
15
- .then(el => {
16
- cy.spy<UI5Element>((el.get(0) as UI5Element), "onInvalidation").as("invalidations");
17
- });
18
-
19
- cy.get("@testGeneric")
20
- .invoke("prop", "strProp", "new value");
21
-
22
- cy.get("@testGeneric")
23
- .invoke("prop", "boolProp", true);
24
-
25
- cy.get("@invalidations")
26
- .should("have.been.calledTwice");
27
- });
28
-
29
- it("Tests that setting a property to the same value does not invalidate", () => {
30
- cy.mount(<Generic></Generic>);
31
-
32
- const text = "new value";
33
-
34
- cy.get<Generic>("[ui5-test-generic]")
35
- .should($el => {
36
- expect($el[0].getDomRef()).to.exist;
37
- });
38
-
39
- cy.get("[ui5-test-generic]")
40
- .as("testGeneric")
41
- .invoke("prop", "strProp", text)
42
- .then(el => {
43
- cy.spy<UI5Element>((el.get(0) as UI5Element), "onInvalidation").as("invalidations");
44
- });
45
-
46
- cy.get("@testGeneric")
47
- .invoke("prop", "strProp", text);
48
-
49
- cy.get("@invalidations")
50
- .should("have.not.been.called");
51
- });
52
-
53
- it("Tests that setting a property of type Object always invalidates", () => {
54
- cy.mount(<Generic></Generic>);
55
-
56
- const obj = {};
57
- const otherObj = {};
58
-
59
- cy.get<Generic>("[ui5-test-generic]")
60
- .should($el => {
61
- expect($el[0].getDomRef()).to.exist;
62
- });
63
-
64
- cy.get("[ui5-test-generic]")
65
- .as("testGeneric")
66
- .invoke("prop", "objectProp", obj)
67
- .then(el => {
68
- cy.spy<UI5Element>((el.get(0) as UI5Element), "onInvalidation").as("invalidations");
69
- });
70
-
71
- cy.get("@testGeneric")
72
- .invoke("prop", "objectProp", otherObj);
73
-
74
- cy.get("@invalidations")
75
- .should("have.been.calledOnce");
76
- });
77
-
78
- it("Tests that setting an array property always invalidates", () => {
79
- cy.mount(<Generic></Generic>);
80
-
81
- const arr: Array<string> = [];
82
- const otherArr: Array<string> = [];
83
-
84
- cy.get<Generic>("[ui5-test-generic]")
85
- .should($el => {
86
- expect($el[0].getDomRef()).to.exist;
87
- });
88
-
89
- cy.get("[ui5-test-generic]")
90
- .as("testGeneric")
91
- .invoke("prop", "multiProp", arr)
92
- .then(el => {
93
- cy.spy<UI5Element>((el.get(0) as UI5Element), "onInvalidation").as("invalidations");
94
- });
95
-
96
- cy.get("@testGeneric")
97
- .invoke("prop", "multiProp", otherArr);
98
-
99
- cy.get("@invalidations")
100
- .should("have.been.calledOnce");
101
- });
102
-
103
- it("Tests that adding a child invalidates", () => {
104
- cy.mount(<Generic></Generic>);
105
-
106
- cy.get<Generic>("[ui5-test-generic]")
107
- .should($el => {
108
- expect($el[0].getDomRef()).to.exist;
109
- });
110
-
111
- cy.get("[ui5-test-generic]")
112
- .as("testGeneric")
113
- .then(el => {
114
- cy.spy<UI5Element>((el.get(0) as UI5Element), "onInvalidation").as("invalidations");
115
- });
116
-
117
- cy.get("@testGeneric")
118
- .then($testGeneric => {
119
- const div = document.createElement("div");
120
- $testGeneric.append(div);
121
- });
122
-
123
- cy.get("@invalidations")
124
- .should("have.been.called");
125
- });
126
-
127
- it("Tests that removing a child invalidates", () => {
128
- cy.mount(<Generic></Generic>);
129
-
130
- const div = document.createElement("div");
131
-
132
- cy.get<Generic>("[ui5-test-generic]")
133
- .should($el => {
134
- expect($el[0].getDomRef()).to.exist;
135
- });
136
-
137
- cy.get("[ui5-test-generic]")
138
- .as("testGeneric")
139
- .then($testGeneric => {
140
- $testGeneric.append(div);
141
-
142
- return $testGeneric;
143
- })
144
- .then($testGeneric => {
145
- cy.spy<UI5Element>(($testGeneric.get(0) as UI5Element), "onInvalidation").as("invalidations");
146
- });
147
-
148
- cy.get("@invalidations")
149
- .should("have.not.been.called");
150
-
151
- cy.wrap(div)
152
- .then($div => {
153
- $div.remove();
154
- });
155
-
156
- cy.get("@invalidations")
157
- .should("have.been.called");
158
- });
159
-
160
- it("Tests that modifying textContent invalidates", () => {
161
- cy.mount(<Generic></Generic>);
162
-
163
- cy.get<Generic>("[ui5-test-generic]")
164
- .should($el => {
165
- expect($el[0].getDomRef()).to.exist;
166
- });
167
-
168
- cy.get("[ui5-test-generic]")
169
- .as("testGeneric")
170
- .then($testGeneric => {
171
- $testGeneric.text("test");
172
-
173
- return $testGeneric;
174
- })
175
- .then($testGeneric => {
176
- cy.spy<UI5Element>(($testGeneric.get(0) as UI5Element), "onInvalidation").as("invalidations");
177
- });
178
-
179
- cy.get("@invalidations")
180
- .should("have.not.been.called");
181
-
182
- cy.get("@testGeneric")
183
- .then($testGeneric => {
184
- $testGeneric.text("test2");
185
- });
186
-
187
- cy.get("@invalidations")
188
- .should("have.been.called");
189
- });
190
-
191
- it("Tests that modifying nodeValue invalidates", () => {
192
- cy.mount(<Generic></Generic>);
193
-
194
- cy.get<Generic>("[ui5-test-generic]")
195
- .should($el => {
196
- expect($el[0].getDomRef()).to.exist;
197
- });
198
-
199
- cy.get("[ui5-test-generic]")
200
- .as("testGeneric")
201
- .then($testGeneric => {
202
- $testGeneric.text("test");
203
-
204
- return $testGeneric;
205
- })
206
- .then($testGeneric => {
207
- cy.spy<UI5Element>(($testGeneric.get(0) as UI5Element), "onInvalidation").as("invalidations");
208
- });
209
-
210
- cy.get("@invalidations")
211
- .should("have.not.been.called");
212
-
213
- cy.get("@testGeneric")
214
- .then($testGeneric => {
215
- $testGeneric.get(0).childNodes[0].nodeValue = "test2";
216
- });
217
-
218
- cy.get("@invalidations")
219
- .should("have.been.called");
220
- });
221
-
222
- it("Tests that multiple invalidations result in a single rendering", () => {
223
- cy.mount(<Generic></Generic>);
224
-
225
- cy.get<Generic>("[ui5-test-generic]")
226
- .should($el => {
227
- expect($el[0].getDomRef()).to.exist;
228
- });
229
-
230
- cy.get("[ui5-test-generic]")
231
- .as("testGeneric");
232
-
233
- cy.get("@testGeneric")
234
- .then($testGeneric => {
235
- cy.spy<UI5Element>(($testGeneric.get(0) as UI5Element), "onInvalidation").as("invalidations");
236
-
237
- cy.spy<UI5Element>(($testGeneric.get(0) as UI5Element), "_render").as("rendering");
238
- });
239
-
240
- cy.get("@testGeneric")
241
- .invoke("prop", "strProp", "new");
242
-
243
- cy.get("@testGeneric")
244
- .invoke("prop", "strProp", "new2");
245
-
246
- cy.get("@invalidations")
247
- .should("have.been.calledTwice");
248
-
249
- cy.get("@rendering")
250
- .should("have.been.calledOnce");
251
- });
252
- });