Skip to content

Commit bf6c1ed

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

3 files changed

Lines changed: 21 additions & 13 deletions

File tree

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

Lines changed: 18 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
@@ -489,6 +498,10 @@ describe("ui5 and web components integration", () => {
489498
.find('input')
490499
.focus();
491500

501+
cy.get("#openUI5Combobox1")
502+
.find('input')
503+
.should('be.focused');
504+
492505
cy.realPress("Escape");
493506

494507
cy.get('#dialog1')
@@ -697,14 +710,8 @@ describe("ui5 and web components integration", () => {
697710

698711
cy.get("#openUI5DialogFinal")
699712
.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-
});
713+
.should(isOpenUI5DialogOpen);
714+
cy.wait(1000);
708715

709716
cy.get("#openUI5Dialog1")
710717
.should('not.be.visible');
@@ -722,7 +729,9 @@ describe("ui5 and web components integration", () => {
722729
.should('not.exist');
723730

724731
cy.get("#openUI5DialogWithButtons")
725-
.should('be.visible');
732+
.should('be.visible')
733+
.should(isOpenUI5DialogOpen);
734+
cy.wait(100);
726735

727736
cy.realPress("Escape");
728737

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)