Skip to content

Commit 5439d5e

Browse files
committed
test(textarea): add highlight test for ionic theme
1 parent 751ed3a commit 5439d5e

16 files changed

+120
-0
lines changed

core/src/components/textarea/test/highlight/textarea.e2e.ts

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,3 +347,123 @@ configs({ directions: ['ltr'] }).forEach(({ title, screenshot, config }) => {
347347
});
348348
});
349349
});
350+
351+
configs({ directions: ['ltr'], modes: ['ionic-md'] }).forEach(({ title, screenshot, config }) => {
352+
test.describe(title('textarea: highlights'), () => {
353+
test.describe('textarea: no fill', () => {
354+
test('should render valid state correctly', async ({ page }) => {
355+
await page.setContent(
356+
`
357+
<ion-textarea
358+
359+
class="ion-valid has-focus"
360+
label="Email"
361+
label-placement="stacked"
362+
error-text="Please enter a valid email"
363+
helper-text="Enter an email"
364+
counter="true"
365+
maxlength="20"
366+
></ion-textarea>
367+
`,
368+
config
369+
);
370+
371+
const textarea = page.locator('ion-textarea');
372+
await expect(textarea).toHaveScreenshot(screenshot(`textarea-no-fill-valid`));
373+
});
374+
test('should render invalid state correctly', async ({ page }) => {
375+
await page.setContent(
376+
`
377+
<ion-textarea
378+
379+
class="ion-touched ion-invalid"
380+
label="Email"
381+
label-placement="stacked"
382+
error-text="Please enter a valid email"
383+
helper-text="Enter an email"
384+
counter="true"
385+
maxlength="20"
386+
></ion-textarea>
387+
`,
388+
config
389+
);
390+
391+
const textarea = page.locator('ion-textarea');
392+
await expect(textarea).toHaveScreenshot(screenshot(`textarea-no-fill-invalid`));
393+
});
394+
});
395+
test.describe('textarea: outline', () => {
396+
test('should render valid state correctly', async ({ page }) => {
397+
await page.setContent(
398+
`
399+
<ion-textarea
400+
fill="outline"
401+
402+
class="ion-valid has-focus"
403+
label="Email"
404+
label-placement="stacked"
405+
error-text="Please enter a valid email"
406+
helper-text="Enter an email"
407+
counter="true"
408+
maxlength="20"
409+
></ion-textarea>
410+
`,
411+
config
412+
);
413+
414+
const textarea = page.locator('ion-textarea');
415+
await expect(textarea).toHaveScreenshot(screenshot(`textarea-outline-valid`));
416+
});
417+
test('should render invalid state correctly', async ({ page }) => {
418+
await page.setContent(
419+
`
420+
<ion-textarea
421+
fill="outline"
422+
423+
class="ion-touched ion-invalid"
424+
label="Email"
425+
label-placement="stacked"
426+
error-text="Please enter a valid email"
427+
helper-text="Enter an email"
428+
counter="true"
429+
maxlength="20"
430+
></ion-textarea>
431+
`,
432+
config
433+
);
434+
435+
const textarea = page.locator('ion-textarea');
436+
await expect(textarea).toHaveScreenshot(screenshot(`textarea-outline-invalid`));
437+
});
438+
test('should render custom highlight correctly', async ({ page }) => {
439+
await page.setContent(
440+
`
441+
<style>
442+
ion-textarea.custom {
443+
--highlight-color-valid: purple;
444+
}
445+
</style>
446+
447+
<div class="container">
448+
<ion-textarea
449+
fill="outline"
450+
451+
class="custom has-focus ion-valid"
452+
label="Email"
453+
label-placement="stacked"
454+
error-text="Please enter a valid email"
455+
helper-text="Enter an email"
456+
counter="true"
457+
maxlength="20"
458+
></ion-textarea>
459+
</div>
460+
`,
461+
config
462+
);
463+
464+
const container = page.locator('.container');
465+
await expect(container).toHaveScreenshot(screenshot(`textarea-outline-custom-highlight`));
466+
});
467+
});
468+
});
469+
});
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading

0 commit comments

Comments
 (0)