Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 52 additions & 38 deletions core/src/components/textarea/test/fill/textarea.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { expect } from '@playwright/test';
import { configs, test } from '@utils/test/playwright';

/**
* Fill is only available in MD mode
* Fill is only available in MD and Ionic
*/
configs({ modes: ['md'] }).forEach(({ title, screenshot, config }) => {
configs({ modes: ['md', 'ionic-md'] }).forEach(({ title, screenshot, config }) => {
test.describe(title('textarea: fill'), () => {
test.describe('textarea: fill solid', () => {
test('should not have visual regressions', async ({ page }) => {
Expand All @@ -25,25 +25,6 @@ configs({ modes: ['md'] }).forEach(({ title, screenshot, config }) => {
const textarea = page.locator('ion-textarea');
await expect(textarea).toHaveScreenshot(screenshot(`textarea-fill-solid`));
});
test('should render correctly with floating label', async ({ page }) => {
await page.setContent(
`
<ion-textarea
fill="solid"
label="Email"
label-placement="floating"
value="[email protected]"
helper-text="Enter your email"
maxlength="20"
counter="true"
></ion-textarea>
`,
config
);

const textarea = page.locator('ion-textarea');
await expect(textarea).toHaveScreenshot(screenshot(`textarea-fill-solid-label-floating`));
});
test('should not have visual regressions with shaped solid', async ({ page }) => {
await page.setContent(
`
Expand All @@ -63,11 +44,12 @@ configs({ modes: ['md'] }).forEach(({ title, screenshot, config }) => {
const textarea = page.locator('ion-textarea');
await expect(textarea).toHaveScreenshot(screenshot(`textarea-fill-shaped-solid`));
});
test('padding and border radius should be customizable', async ({ page }) => {
test('padding, border radius, and background should be customizable', async ({ page }) => {
await page.setContent(
`
<style>
ion-textarea {
--background: #e5e5e5 !important;
--border-radius: 10px !important;
--padding-start: 50px !important;
--padding-end: 50px !important;
Expand All @@ -78,7 +60,7 @@ configs({ modes: ['md'] }).forEach(({ title, screenshot, config }) => {
shape="round"
fill="solid"
label="Email"
label-placement="floating"
label-placement="stacked"
value="[email protected]"
helper-text="Enter your email"
maxlength="20"
Expand Down Expand Up @@ -111,13 +93,13 @@ configs({ modes: ['md'] }).forEach(({ title, screenshot, config }) => {
const textarea = page.locator('ion-textarea');
await expect(textarea).toHaveScreenshot(screenshot(`textarea-fill-outline`));
});
test('should render correctly with floating label', async ({ page }) => {
test('should not have visual regressions with shaped outline', async ({ page }) => {
await page.setContent(
`
<ion-textarea
shape="round"
fill="outline"
label="Email"
label-placement="floating"
value="[email protected]"
helper-text="Enter your email"
maxlength="20"
Expand All @@ -128,15 +110,25 @@ configs({ modes: ['md'] }).forEach(({ title, screenshot, config }) => {
);

const textarea = page.locator('ion-textarea');
await expect(textarea).toHaveScreenshot(screenshot(`textarea-fill-outline-label-floating`));
await expect(textarea).toHaveScreenshot(screenshot(`textarea-fill-shaped-outline`));
});
test('should not have visual regressions with shaped outline', async ({ page }) => {
test('padding, border radius, and background should be customizable', async ({ page }) => {
await page.setContent(
`
<style>
ion-textarea {
--background: #e5e5e5 !important;
--border-radius: 10px !important;
--padding-start: 50px !important;
--padding-end: 50px !important;
}
</style>

<ion-textarea
shape="round"
fill="outline"
label="Email"
label-placement="stacked"
value="[email protected]"
helper-text="Enter your email"
maxlength="20"
Expand All @@ -147,21 +139,43 @@ configs({ modes: ['md'] }).forEach(({ title, screenshot, config }) => {
);

const textarea = page.locator('ion-textarea');
await expect(textarea).toHaveScreenshot(screenshot(`textarea-fill-shaped-outline`));
await expect(textarea).toHaveScreenshot(screenshot(`textarea-fill-shaped-outline-custom`));
});
test('padding and border radius should be customizable', async ({ page }) => {
});
});
});

/**
* Fill with floating label is only available in MD mode
*/
configs({ modes: ['md'] }).forEach(({ title, screenshot, config }) => {
test.describe(title('textarea: fill'), () => {
test.describe('textarea: fill solid', () => {
test('should render correctly with floating label', async ({ page }) => {
await page.setContent(
`
<style>
ion-textarea {
--border-radius: 10px !important;
--padding-start: 50px !important;
--padding-end: 50px !important;
}
</style>
<ion-textarea
fill="solid"
label="Email"
label-placement="floating"
value="[email protected]"
helper-text="Enter your email"
maxlength="20"
counter="true"
></ion-textarea>
`,
config
);

const textarea = page.locator('ion-textarea');
await expect(textarea).toHaveScreenshot(screenshot(`textarea-fill-solid-label-floating`));
});
});
test.describe('textarea: fill outline', () => {
test('should render correctly with floating label', async ({ page }) => {
await page.setContent(
`
<ion-textarea
shape="round"
fill="outline"
label="Email"
label-placement="floating"
Expand All @@ -175,7 +189,7 @@ configs({ modes: ['md'] }).forEach(({ title, screenshot, config }) => {
);

const textarea = page.locator('ion-textarea');
await expect(textarea).toHaveScreenshot(screenshot(`textarea-fill-shaped-outline-custom`));
await expect(textarea).toHaveScreenshot(screenshot(`textarea-fill-outline-label-floating`));
});
});
});
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need these rtl tests for the solid shape?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ended up removing rtl for all the fills since the point of these tests are the fills: fcd9937

6 changes: 6 additions & 0 deletions core/src/components/textarea/textarea.ionic.outline.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
// Textarea Fill: Outline, Textarea Wrapper
// ----------------------------------------------------------------

:host(.textarea-fill-outline) .textarea-wrapper {
background: initial;
}

:host(.textarea-fill-outline) .textarea-wrapper-inner {
/**
* The border should be relative to the inner wrapper
Expand All @@ -34,6 +38,8 @@
pointer-events: none;

border: var(--border-width) var(--border-style) var(--border-color);

background: var(--background);
}

// Textarea Fill: Outline, Bottom Content
Expand Down
Loading