Skip to content

Commit 8841115

Browse files
committed
test(searchbar): add snapshots for focus
1 parent 4579aa8 commit 8841115

File tree

4 files changed

+24
-2
lines changed

4 files changed

+24
-2
lines changed

core/src/components/searchbar/test/states/searchbar.e2e.ts

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,30 @@ import { configs, test } from '@utils/test/playwright';
77
*/
88
configs({ modes: ['ionic-md'], directions: ['ltr'] }).forEach(({ title, screenshot, config }) => {
99
test.describe(title('searchbar: focused'), () => {
10+
test('should render focus ring on the component', async ({ page, pageUtils }) => {
11+
await page.setContent(
12+
`
13+
<style>
14+
/* Add padding to the container to prevent the focus ring from being clipped */
15+
#container {
16+
padding: 5px;
17+
}
18+
</style>
19+
20+
<div id="container">
21+
<ion-searchbar></ion-searchbar>
22+
</div>
23+
`,
24+
config
25+
);
26+
27+
await pageUtils.pressKeys('Tab'); // Focused on the input
28+
29+
const container = page.locator('#container');
30+
31+
await expect(container).toHaveScreenshot(screenshot(`searchbar-state-focused`));
32+
});
33+
1034
test('should render focus ring on the cancel button', async ({ page, pageUtils }) => {
1135
await page.setContent(
1236
`
@@ -22,9 +46,7 @@ configs({ modes: ['ionic-md'], directions: ['ltr'] }).forEach(({ title, screensh
2246

2347
await expect(searchbar).toHaveScreenshot(screenshot(`searchbar-state-focused-cancel-button`));
2448
});
25-
});
2649

27-
test.describe(title('searchbar: focused'), () => {
2850
test('should render focus ring on the clear button', async ({ page, pageUtils }) => {
2951
await page.setContent(
3052
`
Loading
Loading
Loading

0 commit comments

Comments
 (0)