Skip to content

Commit be50374

Browse files
committed
test(textarea): update e2e test for new vars
1 parent 3c3118e commit be50374

File tree

2 files changed

+283
-174
lines changed

2 files changed

+283
-174
lines changed

core/src/components/textarea/test/bottom-content/index.html

Lines changed: 69 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<style>
1616
.grid {
1717
display: grid;
18-
grid-template-columns: repeat(3, minmax(250px, 1fr));
18+
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
1919
grid-row-gap: 20px;
2020
grid-column-gap: 20px;
2121
}
@@ -29,13 +29,6 @@
2929
margin-top: 10px;
3030
}
3131

32-
@media screen and (max-width: 800px) {
33-
.grid {
34-
grid-template-columns: 1fr;
35-
padding: 0;
36-
}
37-
}
38-
3932
ion-textarea.custom-error-color {
4033
--highlight-color-invalid: purple;
4134
}
@@ -54,67 +47,111 @@
5447
<div class="grid">
5548
<div class="grid-item">
5649
<h2>No Hint</h2>
57-
<ion-textarea label="Email"></ion-textarea>
50+
<ion-textarea label="Label"></ion-textarea>
51+
</div>
52+
53+
<div class="grid-item">
54+
<h2>No Hint: Stacked</h2>
55+
<ion-textarea label="Label" label-placement="stacked"></ion-textarea>
5856
</div>
5957

6058
<div class="grid-item">
61-
<h2>Helper Hint</h2>
62-
<ion-textarea label="Email" helper-text="Enter your email"></ion-textarea>
59+
<h2>Helper Text</h2>
60+
<ion-textarea label="Label" helper-text="Helper text"></ion-textarea>
6361
</div>
6462

6563
<div class="grid-item">
66-
<h2>Error Hint</h2>
64+
<h2>Helper Text: Stacked</h2>
65+
<ion-textarea label="Label" label-placement="stacked" helper-text="Helper text"></ion-textarea>
66+
</div>
67+
68+
<div class="grid-item">
69+
<h2>Error Text</h2>
70+
<ion-textarea class="ion-touched ion-invalid" label="Label" error-text="Error text"></ion-textarea>
71+
</div>
72+
73+
<div class="grid-item">
74+
<h2>Error Text: Stacked</h2>
6775
<ion-textarea
6876
class="ion-touched ion-invalid"
69-
label="Email"
70-
error-text="Please enter a valid email"
77+
label="Label"
78+
label-placement="stacked"
79+
error-text="Error text"
7180
></ion-textarea>
7281
</div>
7382

7483
<div class="grid-item">
75-
<h2>Custom Error Color</h2>
84+
<h2>Error Text: Custom Color</h2>
7685
<ion-textarea
7786
class="ion-touched ion-invalid custom-error-color"
78-
label="Email"
79-
error-text="Please enter a valid email"
87+
label="Label"
88+
error-text="Error text"
8089
></ion-textarea>
8190
</div>
8291

92+
<div class="grid-item">
93+
<h2>Helper Text: Wrapping</h2>
94+
<ion-textarea
95+
label="Label"
96+
helper-text="Helper text helper text helper text helper text helper text helper text helper text helper text helper text"
97+
>
98+
</ion-textarea>
99+
</div>
100+
83101
<div class="grid-item">
84102
<h2>Counter</h2>
85-
<ion-textarea label="Email" counter="true" maxlength="100"></ion-textarea>
103+
<ion-textarea label="Label" counter="true" maxlength="100"></ion-textarea>
86104
</div>
87105

88106
<div class="grid-item">
89-
<h2>Custom Counter</h2>
90-
<ion-textarea id="custom-counter" label="Email" counter="true" maxlength="100"></ion-textarea>
107+
<h2>Counter: Custom</h2>
108+
<ion-textarea id="custom-counter" label="Label" counter="true" maxlength="100"></ion-textarea>
91109
</div>
92110

93111
<div class="grid-item">
94-
<h2>Counter with Helper</h2>
95-
<ion-textarea label="Email" counter="true" maxlength="100" helper-text="Enter an email"></ion-textarea>
112+
<h2>Counter: with Helper</h2>
113+
<ion-textarea label="Label" counter="true" maxlength="100" helper-text="Helper text"></ion-textarea>
96114
</div>
97115

98116
<div class="grid-item">
99-
<h2>Counter with Error</h2>
117+
<h2>Counter: with Error</h2>
100118
<ion-textarea
101119
class="ion-touched ion-invalid"
102-
label="Email"
120+
label="Label"
103121
counter="true"
104122
maxlength="100"
105-
error-text="Please enter a valid email"
123+
error-text="Error text"
106124
></ion-textarea>
107125
</div>
108126
</div>
109127

110-
<script>
111-
const customCounterTextarea = document.querySelector('ion-textarea#custom-counter');
112-
customCounterTextarea.counterFormatter = (inputLength, maxLength) => {
113-
const length = maxLength - inputLength;
114-
return `${maxLength - inputLength} characters left`;
115-
};
116-
</script>
128+
<button class="expand" onclick="toggleFill()">Toggle Fill</button>
117129
</ion-content>
118130
</ion-app>
131+
132+
<script>
133+
const customCounterTextarea = document.querySelector('ion-textarea#custom-counter');
134+
customCounterTextarea.counterFormatter = (inputLength, maxLength) => {
135+
const length = maxLength - inputLength;
136+
return `${maxLength - inputLength} characters left`;
137+
};
138+
139+
const textareas = document.querySelectorAll('ion-textarea');
140+
141+
function toggleFill() {
142+
textareas.forEach((textarea) => {
143+
switch (textarea.fill) {
144+
case 'outline':
145+
textarea.fill = 'solid';
146+
break;
147+
case 'solid':
148+
textarea.fill = undefined;
149+
break;
150+
default:
151+
textarea.fill = 'outline';
152+
}
153+
});
154+
}
155+
</script>
119156
</body>
120157
</html>

0 commit comments

Comments
 (0)