Skip to content

Commit

Permalink
fix(test): workaround for nav tests
Browse files Browse the repository at this point in the history
  • Loading branch information
manucorporat committed Sep 5, 2018
1 parent 1bcca01 commit a4b1179
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
14 changes: 9 additions & 5 deletions core/src/components/nav/test/nav-controller.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
4 changes: 2 additions & 2 deletions core/src/components/toggle/test/toggle.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit a4b1179

Please sign in to comment.