@ui5/webcomponents-base 2.11.0-rc.1 → 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 +16 -0
- package/dist/.tsbuildinfobuild +1 -1
- package/dist/custom-elements-internal.json +17 -17
- package/dist/custom-elements.json +17 -17
- 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/dist/prod/util/getEffectiveScrollbarStyle.js +3 -1
- package/dist/prod/util/getEffectiveScrollbarStyle.js.map +2 -2
- package/dist/util/getEffectiveScrollbarStyle.d.ts +1 -1
- package/dist/util/getEffectiveScrollbarStyle.js +3 -1
- package/dist/util/getEffectiveScrollbarStyle.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,79 +0,0 @@
|
|
|
1
|
-
import Accessor from "../../test/test-elements/Accessor.js";
|
|
2
|
-
|
|
3
|
-
describe("Framework boot", () => {
|
|
4
|
-
it("Setting property updates attribute, state and DOM", () => {
|
|
5
|
-
cy.mount(<Accessor></Accessor>);
|
|
6
|
-
|
|
7
|
-
cy.get("[ui5-test-accessor]")
|
|
8
|
-
.as("testAccessor")
|
|
9
|
-
.invoke("prop", "myProp", true);
|
|
10
|
-
|
|
11
|
-
cy.get("@testAccessor")
|
|
12
|
-
.should("have.attr", "my-prop");
|
|
13
|
-
|
|
14
|
-
cy.get("@testAccessor")
|
|
15
|
-
.shadow()
|
|
16
|
-
.find("div")
|
|
17
|
-
.should("have.text", "true");
|
|
18
|
-
|
|
19
|
-
cy.get("@testAccessor")
|
|
20
|
-
.should("have.prop", "storage", true);
|
|
21
|
-
|
|
22
|
-
cy.get("[ui5-test-accessor]")
|
|
23
|
-
.as("testAccessor")
|
|
24
|
-
.invoke("prop", "myProp", false);
|
|
25
|
-
|
|
26
|
-
cy.get("@testAccessor")
|
|
27
|
-
.should("not.have.attr", "my-prop");
|
|
28
|
-
|
|
29
|
-
cy.get("@testAccessor")
|
|
30
|
-
.shadow()
|
|
31
|
-
.find("div")
|
|
32
|
-
.should("have.text", "false");
|
|
33
|
-
|
|
34
|
-
cy.get("@testAccessor")
|
|
35
|
-
.should("have.prop", "storage", false);
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
it("Setting attribute updates property, state and DOM", () => {
|
|
39
|
-
cy.mount(<Accessor></Accessor>);
|
|
40
|
-
|
|
41
|
-
cy.get("[ui5-test-accessor]")
|
|
42
|
-
.as("testAccessor")
|
|
43
|
-
.invoke("attr", "my-prop", "");
|
|
44
|
-
|
|
45
|
-
cy.get("@testAccessor")
|
|
46
|
-
.should("have.attr", "my-prop");
|
|
47
|
-
|
|
48
|
-
cy.get("@testAccessor")
|
|
49
|
-
.shadow()
|
|
50
|
-
.find("div")
|
|
51
|
-
.should("have.text", "true");
|
|
52
|
-
|
|
53
|
-
cy.get("@testAccessor")
|
|
54
|
-
.should("have.prop", "storage", true);
|
|
55
|
-
|
|
56
|
-
cy.get("[ui5-test-accessor]")
|
|
57
|
-
.as("testAccessor")
|
|
58
|
-
.invoke("removeAttr", "my-prop");
|
|
59
|
-
|
|
60
|
-
cy.get("@testAccessor")
|
|
61
|
-
.should("not.have.attr", "my-prop");
|
|
62
|
-
|
|
63
|
-
cy.get("@testAccessor")
|
|
64
|
-
.shadow()
|
|
65
|
-
.find("div")
|
|
66
|
-
.should("have.text", "false");
|
|
67
|
-
|
|
68
|
-
cy.get("@testAccessor")
|
|
69
|
-
.should("have.prop", "storage", false);
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
it("should stop searching for accessors when HTMLElement is reached", () => {
|
|
73
|
-
cy.mount(<Accessor></Accessor>);
|
|
74
|
-
|
|
75
|
-
cy.get("[ui5-test-accessor]")
|
|
76
|
-
.invoke("prop", "title")
|
|
77
|
-
.should("be.undefined");
|
|
78
|
-
});
|
|
79
|
-
});
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { registerThemePropertiesLoader } from "../../src/AssetRegistry.js";
|
|
2
|
-
import { boot } from "../../src/Boot.js";
|
|
3
|
-
import { hasStyle } from "../../src/ManagedStyles.js";
|
|
4
|
-
|
|
5
|
-
describe("Framework boot", () => {
|
|
6
|
-
it("Tests theme loading, when registered after 'attachBoot' and 'boot'", () => {
|
|
7
|
-
cy.wrap({ boot })
|
|
8
|
-
.invoke("boot");
|
|
9
|
-
|
|
10
|
-
cy.wrap({ registerThemePropertiesLoader })
|
|
11
|
-
.invoke("registerThemePropertiesLoader", "@ui5/webcomponents-theming", "sap_horizon", () => {
|
|
12
|
-
return Promise.resolve(`:root{ --customCol: #fff; --customBg: #000; }`);
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
cy.wrap({ hasStyle })
|
|
16
|
-
.invoke("hasStyle", "data-ui5-theme-properties", "@ui5/webcomponents-theming")
|
|
17
|
-
.should("be.true");
|
|
18
|
-
});
|
|
19
|
-
});
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import "../../test/test-elements/Accessor.js";
|
|
2
|
-
import { setTheme, getTheme } from "../../src/config/Theme.js";
|
|
3
|
-
import { setThemeRoot, getThemeRoot } from "../../src/config/ThemeRoot.js";
|
|
4
|
-
import { setNoConflict, getNoConflict } from "../../src/config/NoConflict.js";
|
|
5
|
-
|
|
6
|
-
describe("Some configuration options can be changed at runtime", () => {
|
|
7
|
-
it("Tests that theme can be changed", () => {
|
|
8
|
-
const newTheme = "sap_horizon_hcb";
|
|
9
|
-
|
|
10
|
-
cy.wrap({ setTheme })
|
|
11
|
-
.invoke("setTheme", newTheme);
|
|
12
|
-
|
|
13
|
-
cy.wrap({ getTheme })
|
|
14
|
-
.invoke("getTheme")
|
|
15
|
-
.should("equal", newTheme);
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
it("Tests that noConflict can be changed", () => {
|
|
19
|
-
const noConflictObject = { events: ["selection-change"] };
|
|
20
|
-
|
|
21
|
-
cy.wrap({ setNoConflict })
|
|
22
|
-
.invoke("setNoConflict", noConflictObject);
|
|
23
|
-
|
|
24
|
-
cy.wrap({ getNoConflict })
|
|
25
|
-
.invoke("getNoConflict")
|
|
26
|
-
.should("deep.equal", noConflictObject)
|
|
27
|
-
.its("events")
|
|
28
|
-
.should("deep.equal", noConflictObject.events);
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
it("Tests that theme root is applied", () => {
|
|
32
|
-
const newThemeRoot = "https://example.com/";
|
|
33
|
-
|
|
34
|
-
cy.wrap({ setThemeRoot })
|
|
35
|
-
.invoke("setThemeRoot", newThemeRoot);
|
|
36
|
-
|
|
37
|
-
cy.wrap({ getThemeRoot })
|
|
38
|
-
.invoke("getThemeRoot")
|
|
39
|
-
.should("deep.equal", newThemeRoot);
|
|
40
|
-
});
|
|
41
|
-
});
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
import { getAnimationMode } from "../../src/config/AnimationMode.js";
|
|
2
|
-
import { getCalendarType } from "../../src/config/CalendarType.js";
|
|
3
|
-
import { getDefaultFontLoading } from "../../src/config/Fonts.js";
|
|
4
|
-
import TestGeneric from "../../test/test-elements/Generic.js";
|
|
5
|
-
import { getFirstDayOfWeek, getLegacyDateCalendarCustomizing } from "../../src/config/FormatSettings.js";
|
|
6
|
-
import { getLanguage } from "../../src/config/Language.js";
|
|
7
|
-
import { getNoConflict } from "../../src/config/NoConflict.js";
|
|
8
|
-
import { getTheme } from "../../src/config/Theme.js";
|
|
9
|
-
import { getEnableDefaultTooltips } from "../../src/config/Tooltips.js";
|
|
10
|
-
import { resetConfiguration } from "../../src/InitialConfiguration.js";
|
|
11
|
-
|
|
12
|
-
describe("Configuration script", () => {
|
|
13
|
-
const configurationObject = {
|
|
14
|
-
"theme": "sap_horizon_hcb",
|
|
15
|
-
"animationMode": "basic",
|
|
16
|
-
"rtl": true,
|
|
17
|
-
"language": "ja",
|
|
18
|
-
"calendarType": "Japanese",
|
|
19
|
-
"formatSettings": {
|
|
20
|
-
"firstDayOfWeek": 0,
|
|
21
|
-
"legacyDateCalendarCustomizing": [
|
|
22
|
-
{
|
|
23
|
-
"dateFormat": "A",
|
|
24
|
-
"islamicMonthStart": "14351201",
|
|
25
|
-
"gregDate": "20140925",
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
"dateFormat": "A",
|
|
29
|
-
"islamicMonthStart": "14360101",
|
|
30
|
-
"gregDate": "20141024",
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
"dateFormat": "A",
|
|
34
|
-
"islamicMonthStart": "14360201",
|
|
35
|
-
"gregDate": "20141123",
|
|
36
|
-
},
|
|
37
|
-
],
|
|
38
|
-
},
|
|
39
|
-
"noConflict": {
|
|
40
|
-
"events": ["selection-change", "header-click"],
|
|
41
|
-
},
|
|
42
|
-
"defaultFontLoading": false,
|
|
43
|
-
"enableDefaultTooltips": false,
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
before(() => {
|
|
47
|
-
cy.window()
|
|
48
|
-
.then($el => {
|
|
49
|
-
const scriptElement = document.createElement("script");
|
|
50
|
-
scriptElement.type = "application/json";
|
|
51
|
-
scriptElement.setAttribute("data-ui5-config", "true");
|
|
52
|
-
scriptElement.innerHTML = JSON.stringify(configurationObject);
|
|
53
|
-
return $el.document.head.append(scriptElement);
|
|
54
|
-
})
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
cy.wrap({ resetConfiguration })
|
|
58
|
-
.invoke("resetConfiguration", true);
|
|
59
|
-
|
|
60
|
-
cy.mount(<TestGeneric />);
|
|
61
|
-
cy.get("script[data-ui5-config]")
|
|
62
|
-
.should("exist")
|
|
63
|
-
.then($el => {
|
|
64
|
-
return $el.get(0)?.innerHTML;
|
|
65
|
-
})
|
|
66
|
-
.should("equal", JSON.stringify(configurationObject));
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
after(() => {
|
|
70
|
-
cy.window()
|
|
71
|
-
.then($el => {
|
|
72
|
-
const scriptElement = $el.document.head.querySelector("script[data-ui5-config]");
|
|
73
|
-
|
|
74
|
-
scriptElement?.remove();
|
|
75
|
-
})
|
|
76
|
-
})
|
|
77
|
-
|
|
78
|
-
it("getLanguage", () => {
|
|
79
|
-
cy.wrap({ getLanguage })
|
|
80
|
-
.invoke("getLanguage")
|
|
81
|
-
.should("equal", configurationObject.language);
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
it("getCalendarType", () => {
|
|
85
|
-
cy.wrap({ getCalendarType })
|
|
86
|
-
.invoke("getCalendarType")
|
|
87
|
-
.should("equal", configurationObject.calendarType);
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
it("getFirstDayOfWeek", () => {
|
|
91
|
-
cy.wrap({ getFirstDayOfWeek })
|
|
92
|
-
.invoke("getFirstDayOfWeek")
|
|
93
|
-
.should("equal", configurationObject.formatSettings.firstDayOfWeek);
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
it("getLegacyDateCalendarCustomizing", () => {
|
|
97
|
-
cy.wrap({ getLegacyDateCalendarCustomizing })
|
|
98
|
-
.invoke("getLegacyDateCalendarCustomizing")
|
|
99
|
-
.should("deep.equal", configurationObject.formatSettings.legacyDateCalendarCustomizing);
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
it("getAnimationMode", () => {
|
|
103
|
-
cy.wrap({ getAnimationMode })
|
|
104
|
-
.invoke("getAnimationMode")
|
|
105
|
-
.should("equal", configurationObject.animationMode);
|
|
106
|
-
});
|
|
107
|
-
|
|
108
|
-
it("getEnableDefaultTooltips", () => {
|
|
109
|
-
cy.wrap({ getTheme })
|
|
110
|
-
.invoke("getTheme")
|
|
111
|
-
.should("equal", configurationObject.theme);
|
|
112
|
-
});
|
|
113
|
-
|
|
114
|
-
it("getNoConflict", () => {
|
|
115
|
-
cy.wrap({ getNoConflict })
|
|
116
|
-
.invoke("getNoConflict")
|
|
117
|
-
.should("deep.equal", configurationObject.noConflict)
|
|
118
|
-
.its("events")
|
|
119
|
-
.should("deep.equal", configurationObject.noConflict.events);
|
|
120
|
-
});
|
|
121
|
-
|
|
122
|
-
it("getDefaultFontLoading", () => {
|
|
123
|
-
cy.wrap({ getDefaultFontLoading })
|
|
124
|
-
.invoke("getDefaultFontLoading")
|
|
125
|
-
.should("equal", false);
|
|
126
|
-
});
|
|
127
|
-
|
|
128
|
-
it("getEnableDefaultTooltips", () => {
|
|
129
|
-
cy.wrap({ getEnableDefaultTooltips })
|
|
130
|
-
.invoke("getEnableDefaultTooltips")
|
|
131
|
-
.should("equal", false);
|
|
132
|
-
});
|
|
133
|
-
});
|
|
@@ -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,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,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
|
-
});
|