-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(datetime): typing in time now updates value (#25561)
resolves #25560
- Loading branch information
1 parent
3b0ed78
commit 1b1b1a3
Showing
5 changed files
with
108 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
92 changes: 92 additions & 0 deletions
92
core/src/components/picker-internal/test/keyboard-entry/picker-internal.e2e.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
import { expect } from '@playwright/test'; | ||
import { test } from '@utils/test/playwright'; | ||
import type { E2ELocator } from '@utils/test/playwright/page/utils/locator'; | ||
|
||
test.describe('picker-internal: keyboard entry', () => { | ||
test('should scroll to and update the value prop for a single column', async ({ page }) => { | ||
await page.setContent(` | ||
<ion-picker-internal> | ||
<ion-picker-column-internal></ion-picker-column-internal> | ||
</ion-picker-internal> | ||
<script> | ||
const column = document.querySelector('ion-picker-column-internal'); | ||
column.items = [ | ||
{ text: '01', value: 1 }, | ||
{ text: '02', value: 2 }, | ||
{ text: '03', value: 3 }, | ||
{ text: '04', value: 4 }, | ||
{ text: '05', value: 5 } | ||
]; | ||
column.value = 5; | ||
column.numericInput = true; | ||
</script> | ||
`); | ||
|
||
const column = page.locator('ion-picker-column-internal'); | ||
const ionChange = await page.spyOnEvent('ionChange'); | ||
await column.focus(); | ||
|
||
await page.keyboard.press('Digit2'); | ||
|
||
await expect(ionChange).toHaveReceivedEventDetail({ text: '02', value: 2 }); | ||
await expect(column).toHaveJSProperty('value', 2); | ||
}); | ||
|
||
test('should scroll to and update the value prop for multiple columns', async ({ page }) => { | ||
await page.setContent(` | ||
<ion-picker-internal> | ||
<ion-picker-column-internal id="first"></ion-picker-column-internal> | ||
<ion-picker-column-internal id="second"></ion-picker-column-internal> | ||
</ion-picker-internal> | ||
<script> | ||
const firstColumn = document.querySelector('ion-picker-column-internal#first'); | ||
firstColumn.items = [ | ||
{ text: '01', value: 1 }, | ||
{ text: '02', value: 2 }, | ||
{ text: '03', value: 3 }, | ||
{ text: '04', value: 4 }, | ||
{ text: '05', value: 5 } | ||
]; | ||
firstColumn.value = 5; | ||
firstColumn.numericInput = true; | ||
const secondColumn = document.querySelector('ion-picker-column-internal#second'); | ||
secondColumn.items = [ | ||
{ text: '20', value: 20 }, | ||
{ text: '21', value: 21 }, | ||
{ text: '22', value: 22 }, | ||
{ text: '23', value: 23 }, | ||
{ text: '24', value: 24 } | ||
]; | ||
secondColumn.value = 22; | ||
secondColumn.numericInput = true; | ||
</script> | ||
`); | ||
|
||
const firstColumn = page.locator('ion-picker-column-internal#first'); | ||
const secondColumn = page.locator('ion-picker-column-internal#second'); | ||
const highlight = page.locator('ion-picker-internal .picker-highlight'); | ||
const firstIonChange = await (firstColumn as E2ELocator).spyOnEvent('ionChange'); | ||
const secondIonChange = await (secondColumn as E2ELocator).spyOnEvent('ionChange'); | ||
|
||
const box = await highlight.boundingBox(); | ||
if (box !== null) { | ||
await page.mouse.click(box.x + box.width / 2, box.y + box.height / 2); | ||
} | ||
|
||
await expect(firstColumn).toHaveClass(/picker-column-active/); | ||
await expect(secondColumn).toHaveClass(/picker-column-active/); | ||
|
||
await page.keyboard.press('Digit2'); | ||
|
||
await expect(firstIonChange).toHaveReceivedEventDetail({ text: '02', value: 2 }); | ||
await expect(firstColumn).toHaveJSProperty('value', 2); | ||
|
||
await page.keyboard.press('Digit2+Digit4'); | ||
|
||
await expect(secondIonChange).toHaveReceivedEventDetail({ text: '24', value: 24 }); | ||
await expect(secondColumn).toHaveJSProperty('value', 24); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters