Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ui5-page): fix createElement error caused by adding new style property in the constructor #9998

Merged
merged 1 commit into from
Oct 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/fiori/src/Page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,9 @@ class Page extends UI5Element {

constructor() {
super();
}

onEnterDOM(): void {
this.style.setProperty(getScopedVarName("--_ui5-page-animation-duration"), getAnimationMode() === AnimationMode.None ? "0s" : "0.35s");
}

Expand Down
15 changes: 14 additions & 1 deletion packages/fiori/test/specs/Page.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe("Page general interaction", () => {
timeoutMsg: "expected footer to not be visible after 500ms"
});
});

it("tests animation off footer toggling" , async () => {
await browser.url(`test/pages/Page.html?sap-ui-animationMode=none`);

Expand All @@ -43,4 +43,17 @@ describe("Page general interaction", () => {

assert.ok(!(await footer.isDisplayedInViewport()), "Footer should not be visible.");
});

it("createElement does not throw exception", async () => {
let result;

result = await browser.executeAsync(async (done) => {
const p = document.createElement("ui5-page");
// createElement throws exception during attachInternals() call but the exception can not be caught
// so we check if the _internals property is added to the page object
done(p._internals !== undefined);
});

assert.ok( result, "No exception should be thrown");
});
});