Skip to content

Commit bda1911

Browse files
committed
test(modal): verify parentRemovalObserver is not set for controller modals
1 parent def96ab commit bda1911

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

core/src/components/modal/test/basic/modal.e2e.ts

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { expect } from '@playwright/test';
2-
import { configs, test, Viewports } from '@utils/test/playwright';
32
import type { E2EPage } from '@utils/test/playwright';
3+
import { configs, test, Viewports } from '@utils/test/playwright';
44

55
configs({ modes: ['ios'], directions: ['ltr'] }).forEach(({ title, config }) => {
66
test.describe(title('modal: focus trapping'), () => {
@@ -104,6 +104,28 @@ configs().forEach(({ title, screenshot, config }) => {
104104
});
105105

106106
configs({ modes: ['ios'], directions: ['ltr'] }).forEach(({ title, config }) => {
107+
test.describe(title('modal: parent removal observer'), () => {
108+
test('should not set up parentRemovalObserver for controller-created modals', async ({ page }, testInfo) => {
109+
testInfo.annotations.push({
110+
type: 'issue',
111+
description: 'https://github.com/ionic-team/ionic-framework/pull/30845',
112+
});
113+
114+
await page.goto('/src/components/modal/test/basic', config);
115+
const ionModalDidPresent = await page.spyOnEvent('ionModalDidPresent');
116+
117+
await page.click('#basic-modal');
118+
await ionModalDidPresent.next();
119+
120+
const modal = page.locator('ion-modal');
121+
const hasObserver = await modal.evaluate((el: any) => {
122+
return el.parentRemovalObserver !== undefined;
123+
});
124+
125+
expect(hasObserver).toBe(false);
126+
});
127+
});
128+
107129
test.describe(title('modal: backdrop'), () => {
108130
test.beforeEach(async ({ page }) => {
109131
await page.goto('/src/components/modal/test/basic', config);

0 commit comments

Comments
 (0)