mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-19 19:57:22 +08:00
fix(datetime): presentation time emits ionChange once (#24968)
Resolves #24967
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
import { newE2EPage } from '@stencil/core/testing';
|
||||
import { newE2EPage, E2EPage } from '@stencil/core/testing';
|
||||
|
||||
test('presentation', async () => {
|
||||
const page = await newE2EPage({
|
||||
@ -13,3 +13,37 @@ test('presentation', async () => {
|
||||
expect(screenshotCompare).toMatchScreenshot();
|
||||
}
|
||||
});
|
||||
|
||||
describe('presentation: time', () => {
|
||||
|
||||
let page: E2EPage;
|
||||
|
||||
beforeEach(async () => {
|
||||
page = await newE2EPage({
|
||||
url: '/src/components/datetime/test/presentation?ionic:_testing=true'
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the time picker is visible in the view', () => {
|
||||
|
||||
it('manually setting the value should emit ionChange once', async () => {
|
||||
const datetime = await page.find('ion-datetime[presentation="time"]');
|
||||
const didChange = await datetime.spyOnEvent('ionChange');
|
||||
|
||||
await page.$eval('ion-datetime[presentation="time"]', (el: any) => {
|
||||
el.scrollIntoView();
|
||||
});
|
||||
|
||||
await page.$eval('ion-datetime[presentation="time"]', (el: any) => {
|
||||
el.value = '06:02:40';
|
||||
});
|
||||
|
||||
await page.waitForChanges();
|
||||
|
||||
expect(didChange).toHaveReceivedEventTimes(1);
|
||||
expect(didChange).toHaveReceivedEventDetail({ value: '06:02:40' });
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
Reference in New Issue
Block a user