Skip to content

Commit ce05ed3

Browse files
- update SCSS;
- update shape tests; - update snapshots;
1 parent 6e1da24 commit ce05ed3

File tree

30 files changed

+214
-1
lines changed

30 files changed

+214
-1
lines changed

core/src/components/avatar/avatar.ionic.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,5 +175,5 @@
175175
// Avatar Disabled
176176
// --------------------------------------------------
177177
:host(.avatar-disabled) {
178-
@include globals.disabled-state();
178+
opacity: 0.6;
179179
}

core/src/components/avatar/test/shape/avatar.e2e.ts

Lines changed: 183 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,5 +188,188 @@ configs({ directions: ['ltr'], modes: ['ionic-md'] }).forEach(({ config, screens
188188
await expect(container).toHaveScreenshot(screenshot(`avatar-shape-soft-image`));
189189
});
190190
});
191+
192+
test.describe('round-disabled', () => {
193+
test('should not have visual regressions when containing text', async ({ page }) => {
194+
await page.setContent(
195+
`
196+
<ion-avatar shape="round" disabled>AB</ion-avatar>
197+
`,
198+
config
199+
);
200+
201+
const avatar = page.locator('ion-avatar');
202+
203+
await expect(avatar).toHaveScreenshot(screenshot(`avatar-disabled-shape-round-text`));
204+
});
205+
206+
test('should not have visual regressions when containing an icon', async ({ page }) => {
207+
await page.setContent(
208+
`
209+
<ion-avatar shape="round" disabled>
210+
<ion-icon name="person-outline"></ion-icon>
211+
</ion-avatar>
212+
`,
213+
config
214+
);
215+
216+
const avatar = page.locator('ion-avatar');
217+
218+
await expect(avatar).toHaveScreenshot(screenshot(`avatar-disabled-shape-round-icon`));
219+
});
220+
221+
test('should not have visual regressions when containing an image', async ({ page }) => {
222+
await page.setContent(
223+
`
224+
<ion-avatar shape="round" disabled>
225+
<img src="/src/components/avatar/test/avatar.svg"/>
226+
</ion-avatar>
227+
`,
228+
config
229+
);
230+
231+
const avatar = page.locator('ion-avatar');
232+
233+
await expect(avatar).toHaveScreenshot(screenshot(`avatar-disabled-shape-round-image`));
234+
});
235+
});
236+
237+
test.describe('rectangular-disabled', () => {
238+
test('should not have visual regressions when containing text', async ({ page }) => {
239+
await page.setContent(
240+
`
241+
<ion-avatar shape="rectangular" disabled>AB</ion-avatar>
242+
`,
243+
config
244+
);
245+
246+
const avatar = page.locator('ion-avatar');
247+
248+
await expect(avatar).toHaveScreenshot(screenshot(`avatar-disabled-shape-rectangular-text`));
249+
});
250+
251+
test('should not have visual regressions when containing an icon', async ({ page }) => {
252+
await page.setContent(
253+
`
254+
<ion-avatar shape="rectangular" disabled>
255+
<ion-icon name="person-outline"></ion-icon>
256+
</ion-avatar>
257+
`,
258+
config
259+
);
260+
261+
const avatar = page.locator('ion-avatar');
262+
263+
await expect(avatar).toHaveScreenshot(screenshot(`avatar-disabled-shape-rectangular-icon`));
264+
});
265+
266+
test('should not have visual regressions when containing an image', async ({ page }) => {
267+
await page.setContent(
268+
`
269+
<ion-avatar shape="rectangular" disabled>
270+
<img src="/src/components/avatar/test/avatar.svg"/>
271+
</ion-avatar>
272+
`,
273+
config
274+
);
275+
276+
const avatar = page.locator('ion-avatar');
277+
278+
await expect(avatar).toHaveScreenshot(screenshot(`avatar-disabled-shape-rectangular-image`));
279+
});
280+
});
281+
282+
test.describe('soft-disabled', () => {
283+
test('should not have visual regressions when containing text', async ({ page }) => {
284+
await page.setContent(
285+
`
286+
<style>
287+
#container {
288+
display: flex;
289+
gap: 10px;
290+
}
291+
</style>
292+
293+
<div id="container">
294+
<ion-avatar disabled shape="soft" size="xxsmall">A</ion-avatar>
295+
<ion-avatar disabled shape="soft" size="xsmall">AB</ion-avatar>
296+
<ion-avatar disabled shape="soft" size="small">AB</ion-avatar>
297+
<ion-avatar disabled shape="soft">AB</ion-avatar>
298+
</div>
299+
`,
300+
config
301+
);
302+
303+
const container = page.locator('#container');
304+
305+
await expect(container).toHaveScreenshot(screenshot(`avatar-disabled-shape-soft-text`));
306+
});
307+
308+
test('should not have visual regressions when containing an icon', async ({ page }) => {
309+
await page.setContent(
310+
`
311+
<style>
312+
#container {
313+
display: flex;
314+
gap: 10px;
315+
}
316+
</style>
317+
318+
<div id="container">
319+
<ion-avatar disabled shape="soft" size="xxsmall">
320+
<ion-icon name="person-outline"></ion-icon>
321+
</ion-avatar>
322+
<ion-avatar disabled shape="soft" size="xsmall">
323+
<ion-icon name="person-outline"></ion-icon>
324+
</ion-avatar>
325+
<ion-avatar disabled shape="soft" size="small">
326+
<ion-icon name="person-outline"></ion-icon>
327+
</ion-avatar>
328+
<ion-avatar disabled shape="soft">
329+
<ion-icon name="person-outline"></ion-icon>
330+
</ion-avatar>
331+
</div>
332+
`,
333+
config
334+
);
335+
336+
const container = page.locator('#container');
337+
338+
await expect(container).toHaveScreenshot(screenshot(`avatar-disabled-shape-soft-icon`));
339+
});
340+
341+
test('should not have visual regressions when containing an image', async ({ page }) => {
342+
await page.setContent(
343+
`
344+
<style>
345+
#container {
346+
display: flex;
347+
gap: 10px;
348+
}
349+
</style>
350+
351+
<div id="container">
352+
<ion-avatar disabled shape="soft" size="xxsmall">
353+
<img src="/src/components/avatar/test/avatar.svg"/>
354+
</ion-avatar>
355+
<ion-avatar disabled shape="soft" size="xsmall">
356+
<img src="/src/components/avatar/test/avatar.svg"/>
357+
</ion-avatar>
358+
<ion-avatar disabled shape="soft" size="small">
359+
<img src="/src/components/avatar/test/avatar.svg"/>
360+
</ion-avatar>
361+
<ion-avatar disabled shape="soft">
362+
<img src="/src/components/avatar/test/avatar.svg"/>
363+
</ion-avatar>
364+
</div>
365+
`,
366+
config
367+
);
368+
369+
const container = page.locator('#container');
370+
371+
await expect(container).toHaveScreenshot(screenshot(`avatar-disabled-shape-soft-image`));
372+
});
373+
});
191374
});
192375
});
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading

0 commit comments

Comments
 (0)