Skip to content

Commit 6bd7048

Browse files
- re-organize scss;
- add snapshots for ionic readonly; - add snapshots for ionic disabled;
1 parent 47fbbf2 commit 6bd7048

8 files changed

+41
-26
lines changed

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

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,30 @@ configs({ modes: ['ionic-md'], directions: ['ltr'] }).forEach(({ title, screensh
4545
await expect(container).toHaveScreenshot(screenshot(`textarea-focused`));
4646
});
4747
});
48+
49+
test.describe(title('textarea: states'), () => {
50+
test('should render readonly textarea correctly', async ({ page }) => {
51+
await page.setContent(
52+
`
53+
<ion-textarea fill="outline" label="Email" value="[email protected]" readonly="true"></ion-textarea>
54+
`,
55+
config
56+
);
57+
58+
const textarea = page.locator('ion-textarea');
59+
await expect(textarea).toHaveScreenshot(screenshot(`textarea-readonly`));
60+
});
61+
62+
test('should render disabled textarea correctly', async ({ page }) => {
63+
await page.setContent(
64+
`
65+
<ion-textarea fill="outline" label="Email" value="[email protected]" disabled="true"></ion-textarea>
66+
`,
67+
config
68+
);
69+
70+
const textarea = page.locator('ion-textarea');
71+
await expect(textarea).toHaveScreenshot(screenshot(`textarea-disabled`));
72+
});
73+
});
4874
});
2.67 KB
Loading
3.95 KB
Loading
2.7 KB
Loading
2.92 KB
Loading
4.25 KB
Loading
2.99 KB
Loading

core/src/components/textarea/textarea.ionic.scss

Lines changed: 15 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -139,13 +139,6 @@ ion-icon {
139139
--border-width: #{globals.$ion-border-size-025};
140140
}
141141

142-
// Textarea - Readonly
143-
// ----------------------------------------------------------------
144-
145-
:host(.textarea-readonly) {
146-
--background: #{globals.$ion-primitives-neutral-100};
147-
}
148-
149142
// Textarea Highlight
150143
// ----------------------------------------------------------------
151144

@@ -175,6 +168,15 @@ ion-icon {
175168
transform: scale(1);
176169
}
177170

171+
// Textarea Hover
172+
// ----------------------------------------------------------------
173+
174+
@media (any-hover: hover) {
175+
:host(:hover) {
176+
--border-color: #{globals.$ion-primitives-neutral-600};
177+
}
178+
}
179+
178180
// Textarea - Disabled
179181
// ----------------------------------------------------------------
180182

@@ -183,31 +185,18 @@ ion-icon {
183185
--background: #{globals.$ion-primitives-neutral-100};
184186
--border-color: #{globals.$ion-primitives-neutral-300};
185187
--placeholder-color: #{globals.$ion-primitives-neutral-500};
186-
187-
pointer-events: none;
188188
}
189189

190190
:host(.textarea-disabled:not(.ion-valid)) .textarea-bottom .helper-text,
191191
:host(.textarea-disabled) .textarea-bottom .counter,
192-
:host(.textarea-disabled) .label-text-wrapper {
192+
:host(.textarea-disabled) .label-text-wrapper,
193+
:host(.textarea-disabled) .ion-icon {
193194
color: globals.$ion-primitives-neutral-500;
194195
}
195196

196-
:host(.textarea-disabled.has-focus.ion-valid) {
197-
--border-color: rgba(#{globals.$ion-semantics-success-base-rgb}, 0.6);
198-
}
199-
200-
:host(.textarea-disabled.ion-touched.ion-invalid) {
201-
--border-color: rgba(#{globals.$ion-semantics-danger-base-rgb}, 0.6);
202-
}
203-
204-
:host(.textarea-disabled.ion-color) {
205-
--border-color: #{current-color(base, 0.6)};
206-
}
197+
// Textarea - Readonly
198+
// ----------------------------------------------------------------
207199

208-
:host(.textarea-disabled.has-focus.ion-valid) .textarea-bottom .helper-text,
209-
:host(.textarea-disabled.ion-touched.ion-invalid) .error-text,
210-
:host(.textarea-disabled.ion-color) .textarea-bottom .helper-text,
211-
:host(.textarea-disabled.ion-color) .helper-text {
212-
opacity: 0.6;
200+
:host(.textarea-readonly) {
201+
--background: #{globals.$ion-primitives-neutral-100};
213202
}

0 commit comments

Comments
 (0)