test: migrate form control usages to modern syntax (#28897)

Issue number: Internal

---------

<!-- Please do not submit updates to dependencies unless it fixes an
issue. -->

<!-- Please try to limit your pull request to one type (bugfix, feature,
etc). Submit multiple pull requests if needed. -->

## What is the current behavior?
<!-- Please describe the current behavior that you are modifying. -->

Several tests were still using the legacy form syntax.

## What is the new behavior?
<!-- Please describe the behavior or changes that are being added by
this PR. -->

- Migrated tests in `core`, `angular`, and `vue` to use the modern form
syntax (`react` did not have form controls).

I opted not to migrate `item/test/highlight` and `item/test/counter`
because those tests are going to be removed in the future once the
deprecate item APIs are removed.

## Does this introduce a breaking change?

- [ ] Yes
- [x] No

<!--
  If this introduces a breaking change:
1. Describe the impact and migration path for existing applications
below.
  2. Update the BREAKING.md file with the breaking change.
3. Add "BREAKING CHANGE: [...]" to the commit description when merging.
See
https://github.com/ionic-team/ionic-framework/blob/main/.github/CONTRIBUTING.md#footer
for more information.
-->


## Other information

<!-- Any other information that is important to this PR such as
screenshots of how the component looks before and after the change. -->

---------

Co-authored-by: ionitron <hi@ionicframework.com>
Co-authored-by: Maria Hutt <thetaPC@users.noreply.github.com>
This commit is contained in:
Liam DeBeasi
2024-01-30 11:14:02 -05:00
committed by GitHub
parent f6fc22bba6
commit bf34e0e247
123 changed files with 164 additions and 323 deletions

View File

@ -8,7 +8,7 @@ configs({ modes: ['ios'], directions: ['ltr'] }).forEach(({ title, config }) =>
test.describe(title('textarea: events: ionChange'), () => {
test.describe('when the textarea is blurred', () => {
test('should emit if the value has changed', async ({ page }) => {
await page.setContent(`<ion-textarea></ion-textarea>`, config);
await page.setContent(`<ion-textarea aria-label="textarea"></ion-textarea>`, config);
const nativeTextarea = page.locator('ion-textarea textarea');
const ionChangeSpy = await page.spyOnEvent('ionChange');
@ -24,7 +24,10 @@ configs({ modes: ['ios'], directions: ['ltr'] }).forEach(({ title, config }) =>
});
test('should emit if the textarea is cleared with an initial value', async ({ page }) => {
await page.setContent(`<ion-textarea clear-on-edit="true" value="123"></ion-textarea>`, config);
await page.setContent(
`<ion-textarea aria-label="textarea" clear-on-edit="true" value="123"></ion-textarea>`,
config
);
const textarea = page.locator('ion-textarea');
const nativeTextarea = textarea.locator('textarea');
@ -41,7 +44,7 @@ configs({ modes: ['ios'], directions: ['ltr'] }).forEach(({ title, config }) =>
});
test('should not emit if the value is set programmatically', async ({ page }) => {
await page.setContent(`<ion-textarea></ion-textarea>`, config);
await page.setContent(`<ion-textarea aria-label="textarea"></ion-textarea>`, config);
const textarea = page.locator('ion-textarea');
const ionChangeSpy = await page.spyOnEvent('ionChange');
@ -67,7 +70,7 @@ configs({ modes: ['ios'], directions: ['ltr'] }).forEach(({ title, config }) =>
});
test.describe(title('textarea: events: ionInput'), () => {
test('should emit when the user types', async ({ page }) => {
await page.setContent(`<ion-textarea value="some value"></ion-textarea>`, config);
await page.setContent(`<ion-textarea aria-label="textarea" value="some value"></ion-textarea>`, config);
const ionInputSpy = await page.spyOnEvent('ionInput');