Skip to content

Commit 6e28d11

Browse files
committed
test: stabilize OpenUI5andWebCPopups
1 parent 59d6dd0 commit 6e28d11

3 files changed

Lines changed: 15 additions & 13 deletions

File tree

packages/main/cypress/specs/OpenUI5andWebCPopups.cy.tsx

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,15 @@ function openUI5Popover(win, opener) {
215215
});
216216
}
217217

218+
function isOpenUI5DialogOpen($dialog) {
219+
expect(OpenUI5Element).to.exist;
220+
221+
const dialogInstance = OpenUI5Element.getElementById($dialog.attr("id"));
222+
223+
expect(dialogInstance).to.exist
224+
expect(dialogInstance.isOpen()).to.be.true;
225+
};
226+
218227
describe("ui5 and web components integration", () => {
219228
beforeEach(() => {
220229
// mount the components
@@ -697,14 +706,7 @@ describe("ui5 and web components integration", () => {
697706

698707
cy.get("#openUI5DialogFinal")
699708
.should('be.visible')
700-
.should(($dialog) => {
701-
expect(OpenUI5Element).to.exist;
702-
703-
const dialogInstance = OpenUI5Element.getElementById($dialog.attr("id"));
704-
705-
expect(dialogInstance).to.exist
706-
expect(dialogInstance.isOpen()).to.be.true;
707-
});
709+
.should(isOpenUI5DialogOpen);
708710

709711
cy.get("#openUI5Dialog1")
710712
.should('not.be.visible');
@@ -722,7 +724,8 @@ describe("ui5 and web components integration", () => {
722724
.should('not.exist');
723725

724726
cy.get("#openUI5DialogWithButtons")
725-
.should('be.visible');
727+
.should('be.visible')
728+
.should(isOpenUI5DialogOpen);
726729

727730
cy.realPress("Escape");
728731

packages/main/src/Dialog.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -329,10 +329,7 @@ class Dialog extends Popup {
329329

330330
_show() {
331331
super._show();
332-
requestAnimationFrame(() => {
333-
this._updateMediaRange();
334-
this._center();
335-
});
332+
requestAnimationFrame(this._center.bind(this));
336333
}
337334

338335
onBeforeRendering() {

packages/main/src/Popup.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -604,6 +604,8 @@ abstract class Popup extends UI5Element {
604604
if (this.isConnected) {
605605
this.setAttribute("popover", "manual");
606606
this.showPopover();
607+
608+
requestAnimationFrame(this._updateMediaRange.bind(this));
607609
}
608610
}
609611

0 commit comments

Comments
 (0)