Skip to content

Commit d8a1502

Browse files
committed
test(checkbox): update e2e test to reflect moved aria attributes
1 parent bac7383 commit d8a1502

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

core/src/components/checkbox/test/bottom-content/checkbox.e2e.ts

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,16 @@ configs({ modes: ['ios'], directions: ['ltr'] }).forEach(({ title, config }) =>
2424
await expect(helperText).toHaveText('Helper text');
2525
await expect(errorText).toBeHidden();
2626
});
27-
test('input should have an aria-describedby attribute when helper text is present', async ({ page }) => {
27+
test('checkbox should have an aria-describedby attribute when helper text is present', async ({ page }) => {
2828
await page.setContent(
2929
`<ion-checkbox helper-text="Helper text" error-text="Error text">Label</ion-checkbox>`,
3030
config
3131
);
3232

33-
const input = page.locator('ion-checkbox input[type=checkbox]');
33+
const checkbox = page.locator('ion-checkbox');
3434
const helperText = page.locator('ion-checkbox .helper-text');
3535
const helperTextId = await helperText.getAttribute('id');
36-
const ariaDescribedBy = await input.getAttribute('aria-describedby');
36+
const ariaDescribedBy = await checkbox.getAttribute('aria-describedby');
3737

3838
expect(ariaDescribedBy).toBe(helperTextId);
3939
});
@@ -50,45 +50,45 @@ configs({ modes: ['ios'], directions: ['ltr'] }).forEach(({ title, config }) =>
5050
await expect(errorText).toHaveText('Error text');
5151
});
5252

53-
test('input should have an aria-describedby attribute when error text is present', async ({ page }) => {
53+
test('checkbox should have an aria-describedby attribute when error text is present', async ({ page }) => {
5454
await page.setContent(
5555
`<ion-checkbox class="ion-invalid ion-touched" helper-text="Helper text" error-text="Error text">Label</ion-checkbox>`,
5656
config
5757
);
5858

59-
const input = page.locator('ion-checkbox input[type=checkbox]');
59+
const checkbox = page.locator('ion-checkbox');
6060
const errorText = page.locator('ion-checkbox .error-text');
6161
const errorTextId = await errorText.getAttribute('id');
62-
const ariaDescribedBy = await input.getAttribute('aria-describedby');
62+
const ariaDescribedBy = await checkbox.getAttribute('aria-describedby');
6363

6464
expect(ariaDescribedBy).toBe(errorTextId);
6565
});
66-
test('input should have aria-invalid attribute when checkbox is invalid', async ({ page }) => {
66+
test('checkbox should have aria-invalid attribute when checkbox is invalid', async ({ page }) => {
6767
await page.setContent(
6868
`<ion-checkbox class="ion-invalid ion-touched" helper-text="Helper text" error-text="Error text">Label</ion-checkbox>`,
6969
config
7070
);
7171

72-
const input = page.locator('ion-checkbox input[type=checkbox]');
72+
const checkbox = page.locator('ion-checkbox');
7373

74-
await expect(input).toHaveAttribute('aria-invalid');
74+
await expect(checkbox).toHaveAttribute('aria-invalid');
7575
});
76-
test('input should not have aria-invalid attribute when checkbox is valid', async ({ page }) => {
76+
test('checkbox should not have aria-invalid attribute when checkbox is valid', async ({ page }) => {
7777
await page.setContent(
7878
`<ion-checkbox helper-text="Helper text" error-text="Error text">Label</ion-checkbox>`,
7979
config
8080
);
8181

82-
const input = page.locator('ion-checkbox input[type=checkbox]');
82+
const checkbox = page.locator('ion-checkbox');
8383

84-
await expect(input).not.toHaveAttribute('aria-invalid');
84+
await expect(checkbox).not.toHaveAttribute('aria-invalid');
8585
});
86-
test('input should not have aria-describedby attribute when no hint or error text is present', async ({ page }) => {
86+
test('checkbox should not have aria-describedby attribute when no hint or error text is present', async ({ page }) => {
8787
await page.setContent(`<ion-checkbox>Label</ion-checkbox>`, config);
8888

89-
const input = page.locator('ion-checkbox input[type=checkbox]');
89+
const checkbox = page.locator('ion-checkbox');
9090

91-
await expect(input).not.toHaveAttribute('aria-describedby');
91+
await expect(checkbox).not.toHaveAttribute('aria-describedby');
9292
});
9393
});
9494
});

0 commit comments

Comments
 (0)