Skip to content

Commit

Permalink
test(toggle): fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
OS-giulianasilva committed Aug 22, 2024
1 parent 44db9de commit 494f38d
Showing 1 changed file with 24 additions and 3 deletions.
27 changes: 24 additions & 3 deletions core/src/components/toggle/test/states/toggle.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,19 +46,40 @@ configs({ directions: ['ltr'], modes: ['ios', 'md', 'ionic-md'] }).forEach(({ ti
*/
configs({ directions: ['ltr'], modes: ['ionic-md'] }).forEach(({ title, screenshot, config }) => {
test.describe(title('toggle: states (ionic theme)'), () => {
test('should render focused and pressed states correctly', async ({ page }) => {
test('should render focused toggle correctly', async ({ page }) => {
await page.setContent(
`
<ion-toggle class="ion-focused">Label</ion-toggle>
<ion-toggle class="ion-focused" checked>Label</ion-toggle>
`,
config
);

const toggle = page.locator('ion-toggle');
await expect(toggle).toHaveScreenshot(screenshot(`toggle-disabled`));
});

test('should render pressed unchecked toggle correctly', async ({ page }) => {
await page.setContent(
`
<ion-toggle class="ion-activated">Label</ion-toggle>
`,
config
);

const toggle = page.locator('ion-toggle');
await expect(toggle).toHaveScreenshot(screenshot(`toggle-checked`));
});

test('should render pressed checked toggle correctly', async ({ page }) => {
await page.setContent(
`
<ion-toggle class="ion-activated" checked>Label</ion-toggle>
`,
config
);

const toggle = page.locator('ion-toggle');
await expect(toggle).toHaveScreenshot(screenshot(`toggle-states`));
await expect(toggle).toHaveScreenshot(screenshot(`toggle-unchecked`));
});
});
});

0 comments on commit 494f38d

Please sign in to comment.