+
+
+
+ Popover content
+
+
+
+ `,
+ config
+ );
+
+ const ionPopoverDidPresent = await page.spyOnEvent('ionPopoverDidPresent');
+ const ionPopoverDidDismiss = await page.spyOnEvent('ionPopoverDidDismiss');
+ const popover = page.locator('ion-popover');
+
+ await page.click('#trigger');
+ await ionPopoverDidPresent.next();
+ await expect(popover).toBeVisible();
+
+ await page.locator('#container').evaluate((el: HTMLElement) => el.remove());
+
+ const dismissEvent = await ionPopoverDidDismiss.next();
+ expect(dismissEvent.detail.role).toBe('parent-removed');
+ await expect(popover).toBeHidden();
+ await expect(page.locator('body')).not.toHaveClass(/backdrop-no-scroll/);
+ });
+
+ test('should still dismiss on parent removal after the popover was moved', async ({ page }) => {
+ await page.setContent(
+ `
+