@ui5/webcomponents-base 2.8.0 → 2.9.0-rc.0

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 CHANGED
@@ -3,6 +3,25 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [2.9.0-rc.0](https://github.com/SAP/ui5-webcomponents/compare/v2.8.1-rc.0...v2.9.0-rc.0) (2025-03-13)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **ui5-tabcontainer:** allow browser refresh shortcut to work ([#11035](https://github.com/SAP/ui5-webcomponents/issues/11035)) ([a4a0f02](https://github.com/SAP/ui5-webcomponents/commit/a4a0f028f44a60fd6caea0f4ecdac49b0289270d))
12
+
13
+
14
+
15
+
16
+
17
+ ## [2.8.1-rc.0](https://github.com/SAP/ui5-webcomponents/compare/v2.8.0...v2.8.1-rc.0) (2025-03-06)
18
+
19
+ **Note:** Version bump only for package @ui5/webcomponents-base
20
+
21
+
22
+
23
+
24
+
6
25
  # [2.8.0](https://github.com/SAP/ui5-webcomponents/compare/v2.8.0-rc.3...v2.8.0) (2025-03-04)
7
26
 
8
27
 
@@ -44,21 +44,37 @@ describe("Configuration script", () => {
44
44
  };
45
45
 
46
46
  before(() => {
47
- cy.mount(<TestGeneric />, {
48
- ui5Configuration: configurationObject,
49
- });
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
+
50
56
 
51
57
  cy.wrap({ resetConfiguration })
52
58
  .invoke("resetConfiguration", true);
53
59
 
60
+ cy.mount(<TestGeneric />);
54
61
  cy.get("script[data-ui5-config]")
55
62
  .should("exist")
56
63
  .then($el => {
57
- return $el.get(0).innerHTML;
64
+ return $el.get(0)?.innerHTML;
58
65
  })
59
66
  .should("equal", JSON.stringify(configurationObject));
60
67
  });
61
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
+
62
78
  it("getLanguage", () => {
63
79
  cy.wrap({ getLanguage })
64
80
  .invoke("getLanguage")
@@ -5,6 +5,7 @@ import { getLanguage } from "../../src/config/Language.js";
5
5
  import { getCalendarType } from "../../src/config/CalendarType.js";
6
6
  import { getTheme } from "../../src/config/Theme.js";
7
7
  import { getAnimationMode } from "../../src/config/AnimationMode.js";
8
+ import AnimationMode from "../../src/types/AnimationMode.js";
8
9
  import { getThemeRoot } from "../../src/config/ThemeRoot.js";
9
10
 
10
11
  describe("Some settings can be set via SAP UI URL params", () => {
@@ -47,7 +48,7 @@ describe("Some settings can be set via SAP UI URL params", () => {
47
48
  it("Tests that animationMode is applied", () => {
48
49
  cy.wrap({ getAnimationMode })
49
50
  .invoke("getAnimationMode")
50
- .should("equal", "basic");
51
+ .should("equal", AnimationMode.Basic);
51
52
  });
52
53
  });
53
54
 
@@ -55,6 +56,16 @@ describe("Different themeRoot configurations", () => {
55
56
  it("Allowed theme root", () => {
56
57
  const searchParams = "sap-ui-theme=sap_horizon_hcb@https://example.com";
57
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
+
58
69
  cy.stub(internals, "search", () => {
59
70
  return searchParams;
60
71
  });
@@ -71,6 +82,14 @@ describe("Different themeRoot configurations", () => {
71
82
  cy.wrap({ getThemeRoot })
72
83
  .invoke("getThemeRoot")
73
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
+ })
74
93
  });
75
94
 
76
95
  it("Unallowed theme root", () => {
@@ -1,5 +1,3 @@
1
- import { getAnimationMode } from "../../src/config/AnimationMode.js";
2
-
3
1
  describe("Custom mount", () => {
4
2
  it("mount", () => {
5
3
  cy.mount(<button>Test</button>);
@@ -8,27 +6,4 @@ describe("Custom mount", () => {
8
6
  .should("exist")
9
7
  .and("have.text", "Test");
10
8
  });
11
-
12
- it("mount with configuration", () => {
13
- const configurationObject = { "animationMode": "basic" };
14
-
15
- cy.mount(<button>Test with configuration</button>, {
16
- ui5Configuration: configurationObject,
17
- });
18
-
19
- cy.get("button")
20
- .should("exist")
21
- .and("have.text", "Test with configuration");
22
-
23
- cy.get("script[data-ui5-config]")
24
- .should("exist")
25
- .then($el => {
26
- return $el.get(0).innerHTML;
27
- })
28
- .should("equal", JSON.stringify(configurationObject));
29
-
30
- cy.wrap({ getAnimationMode })
31
- .invoke("getAnimationMode")
32
- .should("equal", configurationObject.animationMode);
33
- });
34
9
  });
@@ -0,0 +1,129 @@
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
+ });
@@ -0,0 +1,39 @@
1
+ /// <reference types="cypress" />
2
+ // ***********************************************
3
+ // This example commands.ts shows you how to
4
+ // create various custom commands and overwrite
5
+ // existing commands.
6
+ //
7
+ // For more comprehensive examples of custom
8
+ // commands please read more here:
9
+ // https://on.cypress.io/custom-commands
10
+ // ***********************************************
11
+ //
12
+ //
13
+ // -- This is a parent command --
14
+ // Cypress.Commands.add('login', (email, password) => { ... })
15
+ //
16
+ //
17
+ // -- This is a child command --
18
+ // Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... })
19
+ //
20
+ //
21
+ // -- This is a dual command --
22
+ // Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... })
23
+ //
24
+ //
25
+ // -- This will overwrite an existing command --
26
+ // Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
27
+ //
28
+ // declare global {
29
+ // namespace Cypress {
30
+ // interface Chainable {
31
+ // login(email: string, password: string): Chainable<void>
32
+ // drag(subject: string, options?: Partial<TypeOptions>): Chainable<Element>
33
+ // dismiss(subject: string, options?: Partial<TypeOptions>): Chainable<Element>
34
+ // visit(originalFn: CommandOriginalFn, url: string, options: Partial<VisitOptions>): Chainable<Element>
35
+ // }
36
+ // }
37
+ // }
38
+
39
+ import "@ui5/cypress-internal/commands.js";
@@ -0,0 +1,12 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
6
+ <meta name="viewport" content="width=device-width,initial-scale=1.0">
7
+ <title>Components App</title>
8
+ </head>
9
+ <body>
10
+ <div data-cy-root></div>
11
+ </body>
12
+ </html>
@@ -0,0 +1,36 @@
1
+ // ***********************************************************
2
+ // This example support/component.ts is processed and
3
+ // loaded automatically before your test files.
4
+ //
5
+ // This is a great place to put global configuration and
6
+ // behavior that modifies Cypress.
7
+ //
8
+ // You can change the location of this file or turn off
9
+ // automatically serving support files with the
10
+ // 'supportFile' configuration option.
11
+ //
12
+ // You can read more here:
13
+ // https://on.cypress.io/configuration
14
+ // ***********************************************************
15
+
16
+ // Import commands.js using ES2015 syntax:
17
+ import './commands'
18
+
19
+ import { mount } from '@ui5/cypress-ct-ui5-webc'
20
+
21
+ // Augment the Cypress namespace to include type definitions for
22
+ // your custom command.
23
+ // Alternatively, can be defined in cypress/support/component.d.ts
24
+ // with a <reference path="./component" /> at the top of your spec.
25
+ declare global {
26
+ namespace Cypress {
27
+ interface Chainable {
28
+ mount: typeof mount
29
+ }
30
+ }
31
+ }
32
+
33
+ Cypress.Commands.add('mount', mount)
34
+
35
+ // Example use:
36
+ // cy.mount(MyComponent)
@@ -4,7 +4,6 @@
4
4
  "./**/*"
5
5
  ],
6
6
  "compilerOptions": {
7
- "types": ["@ui5/webcomponents-tools"],
8
7
  "outDir": "dist",
9
8
  "composite": true,
10
9
  "tsBuildInfoFile": "dist/.tsbuildinfobuild",
package/cypress.config.js CHANGED
@@ -1,3 +1,3 @@
1
- import cypressConfig from "@ui5/webcomponents-tools/components-package/cypress.config.js";
1
+ import cypressConfig from "@ui5/cypress-internal/cypress.config.js";
2
2
 
3
3
  export default cypressConfig;