-
Notifications
You must be signed in to change notification settings - Fork 272
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(framework): Allow the registration of custom themes (#1109)
- Loading branch information
1 parent
cf90f82
commit 6a69521
Showing
5 changed files
with
78 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
const assert = require("chai").assert; | ||
|
||
describe("Custom themes can be registered", () => { | ||
browser.url("http://localhost:9191/test-resources/pages/AllTestElements.html"); | ||
|
||
it("Tests that theme parameters are changed on theme change", () => { | ||
const newTheme = 'my_custom_theme'; | ||
|
||
const res = browser.executeAsync( async (newTheme, done) => { | ||
const var1 = "--var1: #555555"; | ||
|
||
window.registerThemeProperties("@ui5/webcomponents-base-test", newTheme, `:root{ ${var1}; }`); | ||
|
||
const config = window['sap-ui-webcomponents-bundle'].configuration; | ||
await config.setTheme(newTheme); | ||
|
||
const style = document.querySelector(`style[data-ui5-theme-properties="@ui5/webcomponents-base-test"]`); | ||
const varsFound = style && style.textContent.includes(var1); | ||
return done(varsFound); | ||
}, newTheme); | ||
|
||
assert.strictEqual(res, true, "Theme parameters changed"); | ||
}); | ||
|
||
}); |