Skip to content

Commit e539620

Browse files
feat(textarea): add small and large sizes for the ionic theme (#29781)
- Adds the `small` and `large` sizes for the `ionic` theme - Adds tests for the sizes to the existing `size` test
1 parent b57f4be commit e539620

File tree

32 files changed

+184
-15
lines changed

32 files changed

+184
-15
lines changed

core/src/components.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3621,7 +3621,7 @@ export namespace Components {
36213621
*/
36223622
"shape"?: 'round';
36233623
/**
3624-
* The size of the textarea. If "large", it will have an increased height. By default the size is "medium". This property only applies to the `"ionic"` theme.
3624+
* The size of the textarea. If "large" it will increase the height of the textarea, while "small" and "medium" provide progressively smaller heights. The default size is "medium". This property only applies to the `"ionic"` theme.
36253625
*/
36263626
"size"?: 'small' | 'medium' | 'large';
36273627
/**
@@ -8981,7 +8981,7 @@ declare namespace LocalJSX {
89818981
*/
89828982
"shape"?: 'round';
89838983
/**
8984-
* The size of the textarea. If "large", it will have an increased height. By default the size is "medium". This property only applies to the `"ionic"` theme.
8984+
* The size of the textarea. If "large" it will increase the height of the textarea, while "small" and "medium" provide progressively smaller heights. The default size is "medium". This property only applies to the `"ionic"` theme.
89858985
*/
89868986
"size"?: 'small' | 'medium' | 'large';
89878987
/**

core/src/components/textarea/test/size/index.html

Lines changed: 54 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,23 +50,70 @@
5050
<ion-content id="content" class="ion-padding">
5151
<div class="grid">
5252
<div class="grid-item">
53-
<h2>No Fill: No Size</h2>
54-
<ion-textarea label="Label" label-placement="stacked" placeholder="Placeholder"></ion-textarea>
53+
<h2>Outline: Small Size</h2>
54+
<ion-textarea
55+
size="small"
56+
fill="outline"
57+
label="Label"
58+
label-placement="stacked"
59+
placeholder="Placeholder"
60+
></ion-textarea>
5561
</div>
5662

5763
<div class="grid-item">
58-
<h2>Outline: No Size</h2>
59-
<ion-textarea fill="outline" label="Label" label-placement="stacked"></ion-textarea>
64+
<h2>Outline: Small Size, Round Shape</h2>
65+
<ion-textarea
66+
size="small"
67+
fill="outline"
68+
shape="round"
69+
label="Label"
70+
label-placement="stacked"
71+
placeholder="Placeholder"
72+
></ion-textarea>
6073
</div>
6174

6275
<div class="grid-item">
63-
<h2>No Fill: No Size, Round Shape</h2>
64-
<ion-textarea shape="round" label="Label" label-placement="stacked"></ion-textarea>
76+
<h2>Outline: No Size</h2>
77+
<ion-textarea
78+
fill="outline"
79+
label="Label"
80+
label-placement="stacked"
81+
placeholder="Placeholder"
82+
></ion-textarea>
6583
</div>
6684

6785
<div class="grid-item">
6886
<h2>Outline: No Size, Round Shape</h2>
69-
<ion-textarea fill="outline" shape="round" label="Label" label-placement="stacked"></ion-textarea>
87+
<ion-textarea
88+
fill="outline"
89+
shape="round"
90+
label="Label"
91+
label-placement="stacked"
92+
placeholder="Placeholder"
93+
></ion-textarea>
94+
</div>
95+
96+
<div class="grid-item">
97+
<h2>Outline: Large Size</h2>
98+
<ion-textarea
99+
size="large"
100+
fill="outline"
101+
label="Label"
102+
label-placement="stacked"
103+
placeholder="Placeholder"
104+
></ion-textarea>
105+
</div>
106+
107+
<div class="grid-item">
108+
<h2>Outline: Large Size, Round Shape</h2>
109+
<ion-textarea
110+
size="large"
111+
fill="outline"
112+
shape="round"
113+
label="Label"
114+
label-placement="stacked"
115+
placeholder="Placeholder"
116+
></ion-textarea>
70117
</div>
71118
</div>
72119
</ion-content>

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

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,57 @@ import { configs, test } from '@utils/test/playwright';
66
*/
77
configs({ modes: ['ionic-md'], directions: ['ltr'] }).forEach(({ title, screenshot, config }) => {
88
test.describe(title('textarea: size'), () => {
9+
test.describe('textarea: size small', () => {
10+
test('should not have visual regressions', async ({ page }) => {
11+
await page.setContent(
12+
`
13+
<ion-textarea
14+
size="small"
15+
label="Email"
16+
17+
></ion-textarea>
18+
`,
19+
config
20+
);
21+
22+
const textarea = page.locator('ion-textarea');
23+
await expect(textarea).toHaveScreenshot(screenshot(`textarea-size-small`));
24+
});
25+
test('should render correctly with stacked label', async ({ page }) => {
26+
await page.setContent(
27+
`
28+
<ion-textarea
29+
size="small"
30+
label="Email"
31+
label-placement="stacked"
32+
33+
></ion-textarea>
34+
`,
35+
config
36+
);
37+
38+
const textarea = page.locator('ion-textarea');
39+
await expect(textarea).toHaveScreenshot(screenshot(`textarea-size-small-label-stacked`));
40+
});
41+
test('should not have visual regressions with fill outline', async ({ page }) => {
42+
await page.setContent(
43+
`
44+
<ion-textarea
45+
size="small"
46+
fill="outline"
47+
label="Email"
48+
label-placement="stacked"
49+
50+
></ion-textarea>
51+
`,
52+
config
53+
);
54+
55+
const textarea = page.locator('ion-textarea');
56+
await expect(textarea).toHaveScreenshot(screenshot(`textarea-size-small-outline`));
57+
});
58+
});
59+
960
test.describe('textarea: size medium', () => {
1061
test('should not have visual regressions', async ({ page }) => {
1162
await page.setContent(
@@ -53,5 +104,56 @@ configs({ modes: ['ionic-md'], directions: ['ltr'] }).forEach(({ title, screensh
53104
await expect(textarea).toHaveScreenshot(screenshot(`textarea-size-medium-outline`));
54105
});
55106
});
107+
108+
test.describe('textarea: size large', () => {
109+
test('should not have visual regressions', async ({ page }) => {
110+
await page.setContent(
111+
`
112+
<ion-textarea
113+
size="large"
114+
label="Email"
115+
116+
></ion-textarea>
117+
`,
118+
config
119+
);
120+
121+
const textarea = page.locator('ion-textarea');
122+
await expect(textarea).toHaveScreenshot(screenshot(`textarea-size-large`));
123+
});
124+
test('should render correctly with stacked label', async ({ page }) => {
125+
await page.setContent(
126+
`
127+
<ion-textarea
128+
size="large"
129+
label="Email"
130+
label-placement="stacked"
131+
132+
></ion-textarea>
133+
`,
134+
config
135+
);
136+
137+
const textarea = page.locator('ion-textarea');
138+
await expect(textarea).toHaveScreenshot(screenshot(`textarea-size-large-label-stacked`));
139+
});
140+
test('should not have visual regressions with fill outline', async ({ page }) => {
141+
await page.setContent(
142+
`
143+
<ion-textarea
144+
size="large"
145+
fill="outline"
146+
label="Email"
147+
label-placement="stacked"
148+
149+
></ion-textarea>
150+
`,
151+
config
152+
);
153+
154+
const textarea = page.locator('ion-textarea');
155+
await expect(textarea).toHaveScreenshot(screenshot(`textarea-size-large-outline`));
156+
});
157+
});
56158
});
57159
});
2.16 KB
Loading
3.45 KB
Loading
2.13 KB
Loading
Loading
Loading
Loading
Loading

0 commit comments

Comments
 (0)