Skip to content

Commit 729566f

Browse files
committed
test(tab-bar): use container
1 parent fc94a0a commit 729566f

File tree

37 files changed

+73
-48
lines changed

37 files changed

+73
-48
lines changed

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

Lines changed: 50 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -13,36 +13,44 @@ configs({ modes: ['ionic-md', 'md', 'ios'] }).forEach(({ title, screenshot, conf
1313
.ionic {
1414
--ion-background-color: #ccc7c7;
1515
}
16+
17+
#container {
18+
padding-top: 5px;
19+
}
1620
</style>
1721
18-
<ion-tab-bar selected-tab="2">
19-
<ion-tab-button tab="1">
20-
<ion-icon name="home-outline"></ion-icon>
21-
<ion-label>Label</ion-label>
22-
</ion-tab-button>
22+
<div id="container" class="ionic">
23+
<ion-tab-bar selected-tab="2">
24+
<ion-tab-button tab="1">
25+
<ion-icon name="home-outline"></ion-icon>
26+
<ion-label>Label</ion-label>
27+
</ion-tab-button>
2328
24-
<ion-tab-button tab="2">
25-
<ion-icon name="home-outline"></ion-icon>
26-
<ion-label>Label</ion-label>
27-
</ion-tab-button>
29+
<ion-tab-button tab="2">
30+
<ion-icon name="home-outline"></ion-icon>
31+
<ion-label>Label</ion-label>
32+
</ion-tab-button>
2833
29-
<ion-tab-button tab="3" class="ion-focused">
30-
<ion-icon name="home-outline"></ion-icon>
31-
<ion-label>Label</ion-label>
32-
</ion-tab-button>
34+
<ion-tab-button tab="3" class="ion-focused">
35+
<ion-icon name="home-outline"></ion-icon>
36+
<ion-label>Label</ion-label>
37+
</ion-tab-button>
3338
34-
<ion-tab-button tab="4" class="ion-activated">
35-
<ion-icon name="home-outline"></ion-icon>
36-
<ion-label>Label</ion-label>
37-
</ion-tab-button>
38-
</ion-tab-bar>
39+
<ion-tab-button tab="4" class="ion-activated">
40+
<ion-icon name="home-outline"></ion-icon>
41+
<ion-label>Label</ion-label>
42+
</ion-tab-button>
43+
</ion-tab-bar>
44+
</div>
3945
`,
4046
config
4147
);
4248

43-
const tabBar = page.locator('ion-tab-bar');
49+
// The border top is not being captured in the screenshot
50+
// so we need padding on a container to make sure it's visible
51+
const container = page.locator('#container');
4452

45-
await expect(tabBar).toHaveScreenshot(screenshot(`tab-bar-default`));
53+
await expect(container).toHaveScreenshot(screenshot(`tab-bar-default`));
4654
});
4755
});
4856
});
@@ -63,29 +71,37 @@ configs().forEach(({ title, screenshot, config }) => {
6371
--ion-safe-area-left: 40px;
6472
--ion-safe-area-right: 20px;
6573
}
74+
75+
#container {
76+
padding-top: 5px;
77+
}
6678
</style>
6779
68-
<ion-tab-bar selected-tab="1">
69-
<ion-tab-button tab="1">
70-
<ion-label>Recents</ion-label>
71-
</ion-tab-button>
80+
<div id="container">
81+
<ion-tab-bar selected-tab="1">
82+
<ion-tab-button tab="1">
83+
<ion-label>Recents</ion-label>
84+
</ion-tab-button>
7285
73-
<ion-tab-button tab="2">
74-
<ion-label>Favorites</ion-label>
75-
<ion-badge>23</ion-badge>
76-
</ion-tab-button>
86+
<ion-tab-button tab="2">
87+
<ion-label>Favorites</ion-label>
88+
<ion-badge>23</ion-badge>
89+
</ion-tab-button>
7790
78-
<ion-tab-button tab="3">
79-
<ion-label>Settings</ion-label>
80-
</ion-tab-button>
81-
</ion-tab-bar>
91+
<ion-tab-button tab="3">
92+
<ion-label>Settings</ion-label>
93+
</ion-tab-button>
94+
</ion-tab-bar>
95+
</div>
8296
`,
8397
config
8498
);
8599

86-
const tabBar = page.locator('ion-tab-bar');
100+
// The border top is not being captured in the screenshot
101+
// so we need padding on a container to make sure it's visible
102+
const container = page.locator('#container');
87103

88-
await expect(tabBar).toHaveScreenshot(screenshot(`tab-bar-safe-area`));
104+
await expect(container).toHaveScreenshot(screenshot(`tab-bar-safe-area`));
89105
});
90106
});
91107
});
79 Bytes
Loading
168 Bytes
Loading
106 Bytes
Loading
74 Bytes
Loading
179 Bytes
Loading
113 Bytes
Loading
40 Bytes
Loading
94 Bytes
Loading
76 Bytes
Loading

0 commit comments

Comments
 (0)