Skip to content

Commit

Permalink
Correct element visibility
Browse files Browse the repository at this point in the history
  • Loading branch information
crazyserver committed Aug 23, 2024
1 parent 6c1c1e7 commit ad1fffc
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/testing/services/behat-dom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -376,21 +376,22 @@ export class TestingBehatDomUtilsService {
'page-core-mainmenu',
'ion-app',
].join(', ')));
const ionApp = document.querySelector<HTMLElement>('ion-app') ?? undefined;

containers = containers
.filter(container => {
if (!this.isElementVisible(container)) {
// Ignore containers not visible.
return false;
}

if (container.tagName === 'ION-ALERT') {
// For some reason, in Behat sometimes alerts aren't removed from DOM, the close animation doesn't finish.
// Filter alerts with pointer-events none since that style is set before the close animation starts.
return container.style.pointerEvents !== 'none';
}

return true;
// Ignore not visible containers.
if (container.tagName === 'ION-APP') {
return this.isElementVisible(container);
}

return this.isElementVisible(container, ionApp);
})
// Sort them by z-index.
.sort((a, b) => Number(getComputedStyle(b).zIndex) - Number(getComputedStyle(a).zIndex));
Expand Down

0 comments on commit ad1fffc

Please sign in to comment.