Skip to content

Commit 9623026

Browse files
committed
test(toolbar): update to check for images vs svgs and slotted
1 parent 7bbee0e commit 9623026

File tree

2 files changed

+29
-7
lines changed

2 files changed

+29
-7
lines changed

core/src/components/toolbar/test/basic/toolbar.e2e.ts

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,25 +20,25 @@ configs({ modes: ['ios', 'md', 'ionic-md'], palettes: ['light', 'dark'], directi
2020
await expect(header).toHaveScreenshot(screenshot(`toolbar-basic-text-only`));
2121
});
2222

23-
test('should not have visual regressions with slotted images', async ({ page }) => {
23+
test('should not have visual regressions with slotted svgs', async ({ page }) => {
2424
await page.setContent(
2525
`
2626
<ion-header>
2727
<ion-toolbar>
28-
<img src="/src/components/toolbar/test/image.svg" style="width: 50px; height: 50px;" slot="start"/>
28+
<img src="/src/components/toolbar/test/image.svg" slot="start"/>
2929
<ion-title>Toolbar</ion-title>
30-
<ion-img src="/src/components/toolbar/test/image.svg" style="width: 50px; height: 50px;" slot="end"/>
30+
<ion-img src="/src/components/toolbar/test/image.svg" slot="end"/>
3131
</ion-toolbar>
3232
</ion-header>
3333
`,
3434
config
3535
);
3636

3737
const header = page.locator('ion-header');
38-
await expect(header).toHaveScreenshot(screenshot(`toolbar-basic-slotted-images`));
38+
await expect(header).toHaveScreenshot(screenshot(`toolbar-basic-slotted-svgs`));
3939
});
4040

41-
test('should not have visual regressions with slotted images with intrinsic width', async ({ page }) => {
41+
test('should not have visual regressions with slotted images', async ({ page }) => {
4242
await page.setContent(
4343
`
4444
<ion-header>
@@ -53,7 +53,29 @@ configs({ modes: ['ios', 'md', 'ionic-md'], palettes: ['light', 'dark'], directi
5353
);
5454

5555
const header = page.locator('ion-header');
56-
await expect(header).toHaveScreenshot(screenshot(`toolbar-basic-slotted-images-intrinsic-width`));
56+
await expect(header).toHaveScreenshot(screenshot(`toolbar-basic-slotted-images`));
57+
});
58+
59+
test('should not have visual regressions with nested slotted images', async ({ page }) => {
60+
await page.setContent(
61+
`
62+
<ion-header>
63+
<ion-toolbar>
64+
<div slot="start">
65+
<img src="https://picsum.photos/id/237/50/50" />
66+
</div>
67+
<ion-title>Image | Ion-Image</ion-title>
68+
<div slot="end">
69+
<ion-img src="https://picsum.photos/id/237/50/50"></ion-img>
70+
</div>
71+
</ion-toolbar>
72+
</ion-header>
73+
`,
74+
config
75+
);
76+
77+
const header = page.locator('ion-header');
78+
await expect(header).toHaveScreenshot(screenshot(`toolbar-basic-nested-slotted-images`));
5779
});
5880
});
5981
}
Lines changed: 1 addition & 1 deletion
Loading

0 commit comments

Comments
 (0)