Skip to content

Commit bc8b59f

Browse files
committed
test(tab-bar): add expand tests
1 parent 8e05a78 commit bc8b59f

File tree

5 files changed

+139
-0
lines changed

5 files changed

+139
-0
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import { expect } from '@playwright/test';
2+
import { configs, test } from '@utils/test/playwright';
3+
4+
/**
5+
* This behavior only applies to the `ionic` theme.
6+
*/
7+
configs({ directions: ['ltr'], modes: ['ionic-md'] }).forEach(({ title, screenshot, config }) => {
8+
test.describe(title('tab-bar: expand'), () => {
9+
test.describe(title('compact'), () => {
10+
test('should not have visual regressions', async ({ page }) => {
11+
await page.setContent(
12+
`
13+
<ion-tab-bar expand="compact">
14+
<ion-tab-button tab="1">
15+
<ion-icon name="triangle-outline"></ion-icon>
16+
<ion-label>Label</ion-label>
17+
</ion-tab-button>
18+
19+
<ion-tab-button tab="2">
20+
<ion-icon name="triangle-outline"></ion-icon>
21+
<ion-label>Label</ion-label>
22+
</ion-tab-button>
23+
24+
<ion-tab-button tab="3">
25+
<ion-icon name="triangle-outline"></ion-icon>
26+
<ion-label>Label</ion-label>
27+
</ion-tab-button>
28+
</ion-tab-bar>
29+
`,
30+
config
31+
);
32+
33+
const tabBar = page.locator('ion-tab-bar');
34+
35+
await expect(tabBar).toHaveScreenshot(screenshot(`tab-bar-expand-compact`));
36+
});
37+
});
38+
});
39+
});
1.26 KB
Loading
Loading
1.29 KB
Loading
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
import { expect } from '@playwright/test';
2+
import { configs, test } from '@utils/test/playwright';
3+
4+
/**
5+
* This behavior only applies to the `ionic` theme.
6+
* This behavior does not vary across directions.
7+
*/
8+
configs({ directions: ['ltr'], modes: ['ionic-md'] }).forEach(({ title, screenshot, config }) => {
9+
test.describe(title('tab-bar: shape'), () => {
10+
test.describe(title('soft'), () => {
11+
test('should not have visual regressions', async ({ page }) => {
12+
await page.setContent(
13+
`
14+
<ion-tab-bar shape="soft">
15+
<ion-tab-button tab="1">
16+
<ion-icon name="triangle-outline"></ion-icon>
17+
<ion-label>Label</ion-label>
18+
</ion-tab-button>
19+
20+
<ion-tab-button tab="2">
21+
<ion-icon name="triangle-outline"></ion-icon>
22+
<ion-label>Label</ion-label>
23+
</ion-tab-button>
24+
25+
<ion-tab-button tab="3">
26+
<ion-icon name="triangle-outline"></ion-icon>
27+
<ion-label>Label</ion-label>
28+
</ion-tab-button>
29+
</ion-tab-bar>
30+
`,
31+
config
32+
);
33+
34+
const tabBar = page.locator('ion-tab-bar');
35+
36+
await expect(tabBar).toHaveScreenshot(screenshot(`tab-bar-shape-soft`));
37+
});
38+
});
39+
40+
test.describe(title('round'), () => {
41+
test('should not have visual regressions', async ({ page }) => {
42+
await page.setContent(
43+
`
44+
<ion-tab-bar shape="round">
45+
<ion-tab-button tab="1">
46+
<ion-icon name="triangle-outline"></ion-icon>
47+
<ion-label>Label</ion-label>
48+
</ion-tab-button>
49+
50+
<ion-tab-button tab="2">
51+
<ion-icon name="triangle-outline"></ion-icon>
52+
<ion-label>Label</ion-label>
53+
</ion-tab-button>
54+
55+
<ion-tab-button tab="3">
56+
<ion-icon name="triangle-outline"></ion-icon>
57+
<ion-label>Label</ion-label>
58+
</ion-tab-button>
59+
</ion-tab-bar>
60+
`,
61+
config
62+
);
63+
64+
const tabBar = page.locator('ion-tab-bar');
65+
66+
await expect(tabBar).toHaveScreenshot(screenshot(`tab-bar-shape-round`));
67+
});
68+
});
69+
70+
test.describe(title('rectangular'), () => {
71+
test('should not have visual regressions', async ({ page }) => {
72+
await page.setContent(
73+
`
74+
<ion-tab-bar shape="rectangular">
75+
<ion-tab-button tab="1">
76+
<ion-icon name="triangle-outline"></ion-icon>
77+
<ion-label>Label</ion-label>
78+
</ion-tab-button>
79+
80+
<ion-tab-button tab="2">
81+
<ion-icon name="triangle-outline"></ion-icon>
82+
<ion-label>Label</ion-label>
83+
</ion-tab-button>
84+
85+
<ion-tab-button tab="3">
86+
<ion-icon name="triangle-outline"></ion-icon>
87+
<ion-label>Label</ion-label>
88+
</ion-tab-button>
89+
</ion-tab-bar>
90+
`,
91+
config
92+
);
93+
94+
const tabBar = page.locator('ion-tab-bar');
95+
96+
await expect(tabBar).toHaveScreenshot(screenshot(`tab-bar-shape-rectangular`));
97+
});
98+
});
99+
});
100+
});

0 commit comments

Comments
 (0)