Skip to content

Commit 9a8400b

Browse files
committed
test(textarea): update e2e test for custom css
1 parent baa1981 commit 9a8400b

File tree

1 file changed

+23
-23
lines changed

1 file changed

+23
-23
lines changed

core/src/components/textarea/test/bottom-content/textarea.e2e.ts

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ configs({ modes: ['ios'], directions: ['ltr'] }).forEach(({ title, config }) =>
3030
config
3131
);
3232

33-
const input = page.locator('ion-textarea textarea');
33+
const textarea = page.locator('ion-textarea textarea');
3434
const helperText = page.locator('ion-textarea .helper-text');
3535
const helperTextId = await helperText.getAttribute('id');
36-
const ariaDescribedBy = await input.getAttribute('aria-describedby');
36+
const ariaDescribedBy = await textarea.getAttribute('aria-describedby');
3737

3838
expect(ariaDescribedBy).toBe(helperTextId);
3939
});
@@ -56,41 +56,41 @@ configs({ modes: ['ios'], directions: ['ltr'] }).forEach(({ title, config }) =>
5656
config
5757
);
5858

59-
const input = page.locator('ion-textarea textarea');
59+
const textarea = page.locator('ion-textarea textarea');
6060
const errorText = page.locator('ion-textarea .error-text');
6161
const errorTextId = await errorText.getAttribute('id');
62-
const ariaDescribedBy = await input.getAttribute('aria-describedby');
62+
const ariaDescribedBy = await textarea.getAttribute('aria-describedby');
6363

6464
expect(ariaDescribedBy).toBe(errorTextId);
6565
});
66-
test('textarea should have aria-invalid attribute when input is invalid', async ({ page }) => {
66+
test('textarea should have aria-invalid attribute when textarea is invalid', async ({ page }) => {
6767
await page.setContent(
6868
`<ion-textarea label="Label" class="ion-invalid ion-touched" helper-text="Helper text" error-text="Error text"></ion-textarea>`,
6969
config
7070
);
7171

72-
const input = page.locator('ion-textarea textarea');
72+
const textarea = page.locator('ion-textarea textarea');
7373

74-
await expect(input).toHaveAttribute('aria-invalid');
74+
await expect(textarea).toHaveAttribute('aria-invalid');
7575
});
76-
test('textarea should not have aria-invalid attribute when input is valid', async ({ page }) => {
76+
test('textarea should not have aria-invalid attribute when textarea is valid', async ({ page }) => {
7777
await page.setContent(
7878
`<ion-textarea label="Label" helper-text="Helper text" error-text="Error text"></ion-textarea>`,
7979
config
8080
);
8181

82-
const input = page.locator('ion-textarea textarea');
82+
const textarea = page.locator('ion-textarea textarea');
8383

84-
await expect(input).not.toHaveAttribute('aria-invalid');
84+
await expect(textarea).not.toHaveAttribute('aria-invalid');
8585
});
8686
test('textarea should not have aria-describedby attribute when no hint or error text is present', async ({
8787
page,
8888
}) => {
8989
await page.setContent(`<ion-textarea label="Label"></ion-textarea>`, config);
9090

91-
const input = page.locator('ion-textarea textarea');
91+
const textarea = page.locator('ion-textarea textarea');
9292

93-
await expect(input).not.toHaveAttribute('aria-describedby');
93+
await expect(textarea).not.toHaveAttribute('aria-describedby');
9494
});
9595
});
9696
});
@@ -151,16 +151,16 @@ configs({ modes: ['ios', 'md'], directions: ['ltr'] }).forEach(({ title, screens
151151
/**
152152
* Customizing supporting text is the same across modes and directions
153153
*/
154-
configs({ modes: ['ios'], directions: ['ltr'] }).forEach(({ title, screenshot, config }) => {
154+
configs({ modes: ['md'], directions: ['ltr'] }).forEach(({ title, screenshot, config }) => {
155155
test.describe(title('textarea: supporting text customization'), () => {
156-
test('should not have visual regressions when rendering helper text with a custom color via css var', async ({
156+
test('should not have visual regressions when rendering helper text with a custom color via css', async ({
157157
page,
158158
}) => {
159159
await page.setContent(
160160
`
161161
<style>
162-
ion-textarea.custom-textarea {
163-
--helper-text-color: green;
162+
ion-textarea.custom-textarea.md .textarea-bottom .helper-text {
163+
color: green;
164164
}
165165
</style>
166166
<ion-textarea class="custom-textarea" label="Label" helper-text="Helper text"></ion-textarea>
@@ -169,16 +169,16 @@ configs({ modes: ['ios'], directions: ['ltr'] }).forEach(({ title, screenshot, c
169169
);
170170

171171
const helperText = page.locator('ion-textarea');
172-
await expect(helperText).toHaveScreenshot(screenshot(`textarea-helper-text-custom-color-var`));
172+
await expect(helperText).toHaveScreenshot(screenshot(`textarea-helper-text-custom-color`));
173173
});
174-
test('should not have visual regressions when rendering error text with a custom color via css var', async ({
174+
test('should not have visual regressions when rendering error text with a custom color via css', async ({
175175
page,
176176
}) => {
177177
await page.setContent(
178178
`
179179
<style>
180-
ion-textarea.custom-textarea {
181-
--error-text-color: purple;
180+
ion-textarea.custom-textarea.md .textarea-bottom .error-text {
181+
color: purple;
182182
}
183183
</style>
184184
<ion-textarea class="ion-invalid ion-touched custom-textarea" label="Label" error-text="Error text"></ion-textarea>
@@ -187,9 +187,9 @@ configs({ modes: ['ios'], directions: ['ltr'] }).forEach(({ title, screenshot, c
187187
);
188188

189189
const errorText = page.locator('ion-textarea');
190-
await expect(errorText).toHaveScreenshot(screenshot(`textarea-error-text-custom-color-var`));
190+
await expect(errorText).toHaveScreenshot(screenshot(`textarea-error-text-custom-color`));
191191
});
192-
test('should not have visual regressions when rendering error text with a custom color via css highlight var', async ({
192+
test('should not have visual regressions when rendering error text with a custom color via css var', async ({
193193
page,
194194
}) => {
195195
await page.setContent(
@@ -205,7 +205,7 @@ configs({ modes: ['ios'], directions: ['ltr'] }).forEach(({ title, screenshot, c
205205
);
206206

207207
const errorText = page.locator('ion-textarea');
208-
await expect(errorText).toHaveScreenshot(screenshot(`textarea-error-text-custom-highlight-var`));
208+
await expect(errorText).toHaveScreenshot(screenshot(`textarea-error-text-custom-color-var`));
209209
});
210210
});
211211
});

0 commit comments

Comments
 (0)