Skip to content

Commit b3e869e

Browse files
test(tab-bar): add snapshot for box shadow (#30134)
Issue number: internal --------- <!-- Please do not submit updates to dependencies unless it fixes an issue. --> <!-- Please try to limit your pull request to one type (bugfix, feature, etc). Submit multiple pull requests if needed. --> ## What is the current behavior? <!-- Please describe the current behavior that you are modifying. --> This PR is a follow-up of this one: #30117 ## What is the new behavior? <!-- Please describe the behavior or changes that are being added by this PR. --> - This PR adds a snapshot test and modifies the existing one in order to test the change done in the previous PR. ## Does this introduce a breaking change? - [ ] Yes - [x] No <!-- If this introduces a breaking change: 1. Describe the impact and migration path for existing applications below. 2. Update the BREAKING.md file with the breaking change. 3. Add "BREAKING CHANGE: [...]" to the commit description when merging. See https://github.com/ionic-team/ionic-framework/blob/main/docs/CONTRIBUTING.md#footer for more information. --> ## Other information <!-- Any other information that is important to this PR such as screenshots of how the component looks before and after the change. --> --------- Co-authored-by: Maria Hutt <[email protected]>
1 parent fe0b32f commit b3e869e

7 files changed

+64
-21
lines changed

core/src/components/tab-bar/test/expand/tab-bar.e2e.ts

Lines changed: 64 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,39 +6,82 @@ import { configs, test } from '@utils/test/playwright';
66
*/
77
configs({ directions: ['ltr'], modes: ['ionic-md'] }).forEach(({ title, screenshot, config }) => {
88
test.describe(title('tab-bar: expand'), () => {
9+
test.describe(title('full'), () => {
10+
test('should not have visual regressions', async ({ page }) => {
11+
await page.setContent(
12+
`
13+
<style>
14+
.container {
15+
padding: 20px 10px;
16+
}
17+
</style>
18+
19+
<div class="container">
20+
<ion-tab-bar expand="full">
21+
<ion-tab-button tab="1">
22+
<ion-icon name="triangle-outline"></ion-icon>
23+
<ion-label>Label</ion-label>
24+
</ion-tab-button>
25+
26+
<ion-tab-button tab="2">
27+
<ion-icon name="triangle-outline"></ion-icon>
28+
<ion-label>Label</ion-label>
29+
</ion-tab-button>
30+
31+
<ion-tab-button tab="3">
32+
<ion-icon name="triangle-outline"></ion-icon>
33+
<ion-label>Label</ion-label>
34+
</ion-tab-button>
35+
</ion-tab-bar>
36+
</div>
37+
`,
38+
config
39+
);
40+
41+
const container = page.locator('.container');
42+
43+
await expect(container).toHaveScreenshot(screenshot(`tab-bar-expand-full`));
44+
});
45+
});
46+
947
test.describe(title('compact'), () => {
1048
test('should not have visual regressions', async ({ page }) => {
1149
await page.setContent(
1250
`
1351
<style>
14-
:root {
15-
background: #ccc7c7;
52+
.container {
53+
padding: 20px 10px;
54+
/* Size is needed because tab bar compact has position absolute and will not capture correctly. */
55+
width: 225px;
56+
height: 96px;
1657
}
1758
</style>
1859
19-
<ion-tab-bar expand="compact">
20-
<ion-tab-button tab="1">
21-
<ion-icon name="triangle-outline"></ion-icon>
22-
<ion-label>Label</ion-label>
23-
</ion-tab-button>
24-
25-
<ion-tab-button tab="2">
26-
<ion-icon name="triangle-outline"></ion-icon>
27-
<ion-label>Label</ion-label>
28-
</ion-tab-button>
29-
30-
<ion-tab-button tab="3">
31-
<ion-icon name="triangle-outline"></ion-icon>
32-
<ion-label>Label</ion-label>
33-
</ion-tab-button>
34-
</ion-tab-bar>
35-
`,
60+
<div class="container">
61+
<ion-tab-bar expand="compact">
62+
<ion-tab-button tab="1">
63+
<ion-icon name="triangle-outline"></ion-icon>
64+
<ion-label>Label</ion-label>
65+
</ion-tab-button>
66+
67+
<ion-tab-button tab="2">
68+
<ion-icon name="triangle-outline"></ion-icon>
69+
<ion-label>Label</ion-label>
70+
</ion-tab-button>
71+
72+
<ion-tab-button tab="3">
73+
<ion-icon name="triangle-outline"></ion-icon>
74+
<ion-label>Label</ion-label>
75+
</ion-tab-button>
76+
</ion-tab-bar>
77+
</div>
78+
`,
3679
config
3780
);
3881

39-
const tabBar = page.locator('ion-tab-bar');
82+
const container = page.locator('.container');
4083

41-
await expect(tabBar).toHaveScreenshot(screenshot(`tab-bar-expand-compact`));
84+
await expect(container).toHaveScreenshot(screenshot(`tab-bar-expand-compact`));
4285
});
4386
});
4487
});
563 Bytes
Loading
Loading
553 Bytes
Loading
3.18 KB
Loading
5.39 KB
Loading
3.32 KB
Loading

0 commit comments

Comments
 (0)