diff --git a/packages/kit-headless/src/components/checkbox/checkbox.test.ts b/packages/kit-headless/src/components/checkbox/checkbox.test.ts index d151a60aa..8e2e311aa 100644 --- a/packages/kit-headless/src/components/checkbox/checkbox.test.ts +++ b/packages/kit-headless/src/components/checkbox/checkbox.test.ts @@ -28,423 +28,408 @@ async function setup(page: Page, exampleName: string) { }; } -test.describe('render behavior', () => { - test.describe('checklist', () => { - test(`GIVEN a mixed checklist - WHEN the checklist renders - IT should render the mixed img - AND not the true img`, async ({ page }) => { - const exampleName = 'test-controlled-list-mixed'; - await setup(page, exampleName); - await expect(page.locator('#mixed-img')).toBeVisible(); - await expect(page.locator('#true-img')).toBeHidden(); - }); - - test(`GIVEN an all-checked checklist - WHEN the checklist renders - IT should render the true img - AND not the mixed img`, async ({ page }) => { - const exampleName = 'test-controlled-list-true'; - await setup(page, exampleName); - await expect(page.locator('#true-img')).toBeVisible(); - await expect(page.locator('#mixed-img')).toBeHidden(); - }); +test.describe('checklist', () => { + test(`GIVEN a mixed checklist + WHEN the checklist renders + IT should render the mixed img + AND not the true img`, async ({ page }) => { + const exampleName = 'test-controlled-list-mixed'; + await setup(page, exampleName); + await expect(page.locator('#mixed-img')).toBeVisible(); + await expect(page.locator('#true-img')).toBeHidden(); + }); - test(`GIVEN an all-unchecked checklist - WHEN the checklist renders - IT should render the true img and the mixed img`, async ({ page }) => { - const exampleName = 'test-controlled-list-false'; - await setup(page, exampleName); - await expect(page.locator('#true-img')).toBeHidden(); - await expect(page.locator('#mixed-img')).toBeHidden(); - }); + test(`GIVEN an all-checked checklist + WHEN the checklist renders + IT should render the true img + AND not the mixed img`, async ({ page }) => { + const exampleName = 'test-controlled-list-true'; + await setup(page, exampleName); + await expect(page.locator('#true-img')).toBeVisible(); + await expect(page.locator('#mixed-img')).toBeHidden(); }); -}); -test.describe('keyboard behavior', () => { - test.describe('single checkbox behavior', () => { - test(`GIVEN a checkbox with a user sig value of true - WHEN the checkbox renders - IT should have aria-checked as true`, async ({ page }) => { - const exampleName = 'test-hero'; - const { getCheckbox } = await setup(page, exampleName); - await expect(getCheckbox()).toBeVisible(); - await expect(getCheckbox()).toHaveAttribute('aria-checked', 'true'); - }), - test(`GIVEN a checkbox with a user sig value of true - WHEN the checkbox is focused and the spacebar is pressed - IT should have aria-checked as false`, async ({ page }) => { - const exampleName = 'test-hero'; - const { getCheckbox } = await setup(page, exampleName); - await expect(getCheckbox()).toBeVisible(); - await getCheckbox().focus(); - await getCheckbox().press(' '); - await expect(getCheckbox()).toHaveAttribute('aria-checked', 'false'); - }); - test(`GIVEN a checkbox with a user sig value of true - WHEN the checkbox is focused and the spacebar is pressed - IT should have its icon hidden`, async ({ page }) => { - const exampleName = 'test-hero'; - const { getCheckbox, getIcon } = await setup(page, exampleName); - await expect(getIcon()).toBeVisible(); - await getCheckbox().focus(); - await getCheckbox().press(' '); - await expect(getCheckbox()).toHaveAttribute('aria-checked', 'false'); - await expect(getIcon()).toBeHidden(); - }); - test(`GIVEN a default checkbox with a default sig value of false - WHEN the checkbox is focused and the spacebar is pressed - IT should have its icon visible`, async ({ page }) => { - const exampleName = 'test-default'; - const { getCheckbox, getIcon } = await setup(page, exampleName); - await expect(getIcon()).toBeHidden(); - await getCheckbox().focus(); - await getCheckbox().press(' '); - await expect(getCheckbox()).toHaveAttribute('aria-checked', 'false'); - await expect(getIcon()).toBeVisible(); - }); + test(`GIVEN an all-unchecked checklist + WHEN the checklist renders + IT should render the true img and the mixed img`, async ({ page }) => { + const exampleName = 'test-controlled-list-false'; + await setup(page, exampleName); + await expect(page.locator('#true-img')).toBeHidden(); + await expect(page.locator('#mixed-img')).toBeHidden(); }); - test.describe('uncontrolled checklist behavior', () => { - test(`GIVEN a checklist with checkboxes + + test(`GIVEN a checklist with checkboxes WHEN the elements render THEN the checklist should be a