mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-20 20:33:32 +08:00
fix(overlay): ensure lifecycles fire properly (#19579)
This commit is contained in:
@ -14,8 +14,16 @@ export const testModal = async (
|
|||||||
});
|
});
|
||||||
|
|
||||||
const screenshotCompares = [];
|
const screenshotCompares = [];
|
||||||
|
const ionModalWillPresent = await page.spyOnEvent('ionModalWillPresent');
|
||||||
|
const ionModalDidPresent = await page.spyOnEvent('ionModalDidPresent');
|
||||||
|
const ionModalWillDismiss = await page.spyOnEvent('ionModalWillDismiss');
|
||||||
|
const ionModalDidDismiss = await page.spyOnEvent('ionModalDidDismiss');
|
||||||
|
|
||||||
await page.click(selector);
|
await page.click(selector);
|
||||||
|
|
||||||
|
await ionModalWillPresent.next();
|
||||||
|
await ionModalDidPresent.next();
|
||||||
|
|
||||||
await page.waitForSelector(selector);
|
await page.waitForSelector(selector);
|
||||||
|
|
||||||
let modal = await page.find('ion-modal');
|
let modal = await page.find('ion-modal');
|
||||||
@ -25,6 +33,10 @@ export const testModal = async (
|
|||||||
screenshotCompares.push(await page.compareScreenshot());
|
screenshotCompares.push(await page.compareScreenshot());
|
||||||
|
|
||||||
await modal.callMethod('dismiss');
|
await modal.callMethod('dismiss');
|
||||||
|
|
||||||
|
await ionModalWillDismiss.next();
|
||||||
|
await ionModalDidDismiss.next();
|
||||||
|
|
||||||
await modal.waitForNotVisible();
|
await modal.waitForNotVisible();
|
||||||
|
|
||||||
screenshotCompares.push(await page.compareScreenshot('dismiss'));
|
screenshotCompares.push(await page.compareScreenshot('dismiss'));
|
||||||
|
@ -221,7 +221,7 @@ const overlayAnimation = async (
|
|||||||
/**
|
/**
|
||||||
* TODO: Remove AnimationBuilder
|
* TODO: Remove AnimationBuilder
|
||||||
*/
|
*/
|
||||||
const hasCompleted = (typeof animationResult as any === 'boolean') ? animationResult : (animation as any).hasCompleted;
|
const hasCompleted = (typeof animationResult as any === 'undefined') ? true : (animation as any).hasCompleted;
|
||||||
if (isAnimationBuilder) {
|
if (isAnimationBuilder) {
|
||||||
animation.destroy();
|
animation.destroy();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user