fix(test): workaround for nav tests

This commit is contained in:
Manu Mtz.-Almeida
2018-09-05 23:55:26 +02:00
parent 1bcca01e1a
commit a4b11797e4
2 changed files with 11 additions and 7 deletions

View File

@ -888,11 +888,15 @@ describe('NavController', () => {
ionViewWillUnload: jest.spyOn(element, 'ionViewWillUnload'),
};
element.addEventListener('ionViewWillEnter', element.ionViewWillEnter);
element.addEventListener('ionViewDidEnter', element.ionViewDidEnter);
element.addEventListener('ionViewWillLeave', element.ionViewWillLeave);
element.addEventListener('ionViewDidLeave', element.ionViewDidLeave);
element.addEventListener('ionViewWillUnload', element.ionViewWillUnload);
element.dispatchEvent = (ev: CustomEvent) => {
switch(ev.type) {
case 'ionViewWillEnter': element.ionViewWillEnter(); break;
case 'ionViewDidEnter': element.ionViewDidEnter(); break;
case 'ionViewWillLeave': element.ionViewWillLeave(); break;
case 'ionViewDidLeave': element.ionViewDidLeave(); break;
case 'ionViewWillUnload': element.ionViewWillUnload(); break;
}
};
return instance;
}

View File

@ -44,7 +44,7 @@ describe('toggle', () => {
});
// set unchecked
await toggle.setProperty('checked', false);
toggle.setProperty('checked', false);
// wait for the changes to apply
await page.waitForChanges();
@ -97,7 +97,7 @@ describe('toggle', () => {
expect(checkedValue).toBe(true);
// set checked true again, no actual change
await toggle.setProperty('checked', true);
toggle.setProperty('checked', true);
// wait for the changes to apply
await page.waitForChanges();