-
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(textarea): clearOnEdit clears textarea when user initially types (#…
- Loading branch information
1 parent
bf5e118
commit f7176bb
Showing
4 changed files
with
63 additions
and
22 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
35 changes: 35 additions & 0 deletions
35
core/src/components/textarea/test/clearOnEdit/textarea.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,35 @@ | ||
import { expect } from '@playwright/test'; | ||
import { test } from '@utils/test/playwright'; | ||
|
||
test.describe('textarea: clearOnEdit', () => { | ||
test.beforeEach(async ({ skip }) => { | ||
skip.rtl(); | ||
skip.mode('md'); | ||
}); | ||
|
||
test('should clear the textarea on first keystroke of textarea being focused', async ({ page }) => { | ||
await page.setContent(`<ion-textarea value="some value" clear-on-edit="true"></ion-textarea>`); | ||
|
||
const textarea = page.locator('ion-textarea'); | ||
|
||
await textarea.click(); | ||
await textarea.type('h'); | ||
|
||
expect(await textarea.evaluate((el: HTMLIonTextareaElement) => el.value)).toBe('h'); | ||
|
||
await textarea.type('ello world'); | ||
|
||
expect(await textarea.evaluate((el: HTMLIonTextareaElement) => el.value)).toBe('hello world'); | ||
}); | ||
|
||
test('should not clear the textarea if it does not have an initial value when typing', async ({ page }) => { | ||
await page.setContent(`<ion-textarea value="" clear-on-edit="true"></ion-textarea>`); | ||
|
||
const textarea = page.locator('ion-textarea'); | ||
|
||
await textarea.click(); | ||
await textarea.type('hello world'); | ||
|
||
expect(await textarea.evaluate((el: HTMLIonTextareaElement) => el.value)).toBe('hello world'); | ||
}); | ||
}); |
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