Skip to content

Commit 5de7bca

Browse files
- fix automated test with waitingForChanges;
1 parent a21501d commit 5de7bca

File tree

1 file changed

+4
-13
lines changed

1 file changed

+4
-13
lines changed

core/src/components/datetime/test/show-adjacent-days/datetime.e2e.ts

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -52,34 +52,25 @@ configs({ directions: ['ltr'] }).forEach(({ title, screenshot, config }) => {
5252
await page.setContent(
5353
`
5454
<ion-datetime show-adjacent-days="true" locale="en-US" value="2022-10-14T16:22:00.000Z" presentation="date"></ion-datetime>
55-
<script>
56-
const mockToday = '2022-10-10T16:22';
57-
Date = class extends Date {
58-
constructor(...args) {
59-
if (args.length === 0) {
60-
super(mockToday)
61-
} else {
62-
super(...args);
63-
}
64-
}
65-
}
66-
</script>
6755
`,
6856
config
6957
);
70-
await page.locator('.datetime-ready').waitFor();
7158
const datetime = page.locator('ion-datetime');
7259
const ionChange = await page.spyOnEvent('ionChange');
7360
// Oct 20, 2022
7461
await page.click('.calendar-day[data-month="10"][data-year="2022"][data-day="20"]');
62+
await ionChange.next();
7563
await expect(ionChange).toHaveReceivedEventDetail({ value: '2022-10-20T16:22:00' });
7664
await expect(datetime).toHaveJSProperty('value', '2022-10-20T16:22:00');
7765
// Nov 1, 2022
7866
await page.click('.calendar-day[data-month="11"][data-year="2022"][data-day="1"]');
67+
await page.waitForChanges();
68+
await ionChange.next();
7969
await expect(ionChange).toHaveReceivedEventDetail({ value: '2022-11-01T16:22:00' });
8070
await expect(datetime).toHaveJSProperty('value', '2022-11-01T16:22:00');
8171
// Nov 22, 2022
8272
await page.click('.calendar-day[data-month="11"][data-year="2022"][data-day="22"]');
73+
await ionChange.next();
8374
await expect(ionChange).toHaveReceivedEventDetail({ value: '2022-11-22T16:22:00' });
8475
await expect(datetime).toHaveJSProperty('value', '2022-11-22T16:22:00');
8576
});

0 commit comments

Comments
 (0)