An open source design system that's fully customizable and agent ready
TypeScript
test(rtl): RTL coverage for Tab, TabMenu, SegmentedControlItem and ToggleButtonGroup (#9330)
Cindy Zhangdf7ad1bd542a
diff --git a/apps/storybook/rtl-audit/targets.json b/apps/storybook/rtl-audit/targets.jsonindex 3dd9f037fd..3158b4d5a9 100644--- a/apps/storybook/rtl-audit/targets.json+++ b/apps/storybook/rtl-audit/targets.json@@ -739,6 +739,62 @@"next": ".astryx-file-input > .astryx-input-status-icon"}},+ {+ "component": "Tab",+ "storyId": "core-tablist--with-icons",+ "dims": ["D2"],+ "selectors": {+ "prev": ".astryx-tab svg",+ "next": ".astryx-tab span:text-is(\"Home\")"+ }+ },+ {+ "component": "TabMenu",+ "storyId": "core-tablist--with-menu",+ "dims": ["D2"],+ "selectors": {+ "prev": ".astryx-tab-menu span:text-is(\"More\")",+ "next": ".astryx-tab-menu .astryx-icon"+ }+ },+ {+ "component": "SegmentedControlItem",+ "storyId": "core-segmentedcontrol--with-icons",+ "dims": ["D2"],+ "selectors": {+ "prev": "[role=\"radio\"] svg.astryx-icon",+ "next": "[role=\"radio\"] span:text-is(\"Grid\")"+ }+ },+ {+ "component": "ToggleButtonGroup",+ "storyId": "core-togglebutton--group-single",+ "dims": ["D2"],+ "selectors": {+ "prev": "button[aria-label=\"List view\"]",+ "next": "button[aria-label=\"Grid view\"]"+ }+ },+ {+ "component": "TabList",+ "storyId": "core-tablist--with-icons",+ "dims": []+ },+ {+ "component": "TabList",+ "storyId": "core-tablist--with-menu",+ "dims": []+ },+ {+ "component": "SegmentedControl",+ "storyId": "core-segmentedcontrol--with-icons",+ "dims": []+ },+ {+ "component": "ToggleButton",+ "storyId": "core-togglebutton--group-single",+ "dims": []+ },{"component": "Outline","storyId": "core-outline--controlled",diff --git a/docs/specs/components/SegmentedControl/SegmentedControlItem.spec.md b/docs/specs/components/SegmentedControl/SegmentedControlItem.spec.mdindex 8e10893aa1..04e9016a6a 100644--- a/docs/specs/components/SegmentedControl/SegmentedControlItem.spec.md+++ b/docs/specs/components/SegmentedControl/SegmentedControlItem.spec.md@@ -29,6 +29,7 @@ verified_by:packages/core/src/RadioList/__tests__/RadioGroup.a11y.test.tsx,packages/core/src/RadioList/__tests__/RadioGroup.a11y.chromium.spec.ts,packages/core/src/__tests__/PressedState.a11y.chromium.spec.ts,+ apps/storybook/rtl-audit/targets.json,]modules: []families: []@@ -166,14 +167,15 @@ theming anatomy.## Verification map-| Contract | Verification | Representative states | Mutation or failure expectation | Audit section |-| -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------ |-| FR1 | `SegmentedControl.test.tsx` aria-checked and data-testid cases; `RadioGroup.a11y.test.tsx` and `RadioGroup.a11y.chromium.spec.ts` (in `RadioList/__tests__`) `segmented-option-*` states | Selection change; data-testid | Stale `aria-checked` fails. Evidence gap: no test passes `role` to a segment; the role-override case covers the radiogroup. | `audit:SegmentedControlItem/accessibility` |-| FR2 | `SegmentedControl.test.tsx` click and onClick-composition cases | Click; selected click; prevented click | A selected or prevented click that selects fails. Evidence gap: no test covers a press while focus is already in the group. | `audit:SegmentedControlItem/behavior` |-| FR3 | `SegmentedControl.test.tsx` icon, icon-only, and truncation cases | Icon and label; icon-only; long label | A missing name, or an icon that truncates, fails. | `audit:SegmentedControlItem/anatomy` |-| FR4 | `SegmentedControl.test.tsx` disabled cases; `RadioGroup.a11y.test.tsx` and `RadioGroup.a11y.chromium.spec.ts` (in `RadioList/__tests__`) `segmented-option-disabled` and `segmented-option-group-disabled*` states | Item and group disabled | A disabled segment that selects fails. Evidence gap: no test asserts the disabled text color, absent hover paint, or the caller `onClick` while disabled. The `segmented-option-group-disabled` state declares a checked, group-disabled segment that keeps the Tab stop. | `audit:SegmentedControlItem/accessibility` |-| FR5 | `SegmentedControl.test.tsx` forced-colors and pressed-state cases; `PressedState.a11y.chromium.spec.ts` segmented-control cases | Selected under forced colors; press; disabled | Lost forced-colors state, or press paint on a disabled segment, fails. Evidence gap: no test asserts the raised selected surface or the hover tint. | `audit:SegmentedControlItem/visual` |-| FR6, FR7 | Evidence gap: no test of segment heights, text growth, focus outline, `ref`, or `xstyle` order | — | — | `audit:SegmentedControlItem/layout` |+| Contract | Verification | Representative states | Mutation or failure expectation | Audit section |+| ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------ |+| FR1 | `SegmentedControl.test.tsx` aria-checked and data-testid cases; `RadioGroup.a11y.test.tsx` and `RadioGroup.a11y.chromium.spec.ts` (in `RadioList/__tests__`) `segmented-option-*` states | Selection change; data-testid | Stale `aria-checked` fails. Evidence gap: no test passes `role` to a segment; the role-override case covers the radiogroup. | `audit:SegmentedControlItem/accessibility` |+| FR2 | `SegmentedControl.test.tsx` click and onClick-composition cases | Click; selected click; prevented click | A selected or prevented click that selects fails. Evidence gap: no test covers a press while focus is already in the group. | `audit:SegmentedControlItem/behavior` |+| FR3 | `SegmentedControl.test.tsx` icon, icon-only, and truncation cases | Icon and label; icon-only; long label | A missing name, or an icon that truncates, fails. | `audit:SegmentedControlItem/anatomy` |+| FR4 | `SegmentedControl.test.tsx` disabled cases; `RadioGroup.a11y.test.tsx` and `RadioGroup.a11y.chromium.spec.ts` (in `RadioList/__tests__`) `segmented-option-disabled` and `segmented-option-group-disabled*` states | Item and group disabled | A disabled segment that selects fails. Evidence gap: no test asserts the disabled text color, absent hover paint, or the caller `onClick` while disabled. The `segmented-option-group-disabled` state declares a checked, group-disabled segment that keeps the Tab stop. | `audit:SegmentedControlItem/accessibility` |+| FR5 | `SegmentedControl.test.tsx` forced-colors and pressed-state cases; `PressedState.a11y.chromium.spec.ts` segmented-control cases | Selected under forced colors; press; disabled | Lost forced-colors state, or press paint on a disabled segment, fails. Evidence gap: no test asserts the raised selected surface or the hover tint. | `audit:SegmentedControlItem/visual` |+| FR6, FR7 | Evidence gap: no test of segment heights, text growth, focus outline, `ref`, or `xstyle` order | — | — | `audit:SegmentedControlItem/layout` |+| RTL relation | RTL audit curated D2 target (`apps/storybook/rtl-audit/targets.json`) on `SegmentedControl / With icons` | Segment icon and label; LTR and RTL | An icon that is not at the inline start of its label fails D2. | `audit:SegmentedControlItem/i18n-rtl` |## Current-state impactdiff --git a/docs/specs/components/TabList/Tab.spec.md b/docs/specs/components/TabList/Tab.spec.mdindex 8c2e49f416..6cd0b7706b 100644--- a/docs/specs/components/TabList/Tab.spec.md+++ b/docs/specs/components/TabList/Tab.spec.md@@ -16,6 +16,7 @@ verified_by:packages/core/src/TabList/__tests__/Tabs.a11y.test.tsx,packages/core/src/TabList/__tests__/Tabs.a11y.chromium.spec.ts,apps/storybook/stories/TabList.stories.tsx,+ apps/storybook/rtl-audit/targets.json,]modules: []families: [family:navigation-destinations]@@ -169,12 +170,13 @@ FR1–FR2.## Verification map-| Contract | Verification | Representative states | Mutation or failure expectation | Audit section |-| -------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------- | ------------------------------------------------ | ------------------------- |-| FR1, FR2 | `TabList.test.tsx` aria-current, polymorphic link, and tabs-pattern tests; `Tabs.a11y.test.tsx`; `Tabs.a11y.chromium.spec.ts` for `aria-selected` | Navigation, link, tabs | Wrong role or state fails. | `audit:Tab/accessibility` |-| FR3 | `TabList.test.tsx` single tab stop and roving tabindex tests | Selected | Extra tab stops, or a wrong starting stop, fail. | `audit:Tab/accessibility` |-| FR4, FR5 | `TabList.test.tsx` onChange and disabled tests | Click, disabled button | Selection when disabled fails. | `audit:Tab/behavior` |-| FR6, FR7 | `TabList.test.tsx` icon, icon-only, and pressed-overlay tests | Icon, selected icon, hidden label | Wrong icon, name, or overlay fails. | `audit:Tab/behavior` |+| Contract | Verification | Representative states | Mutation or failure expectation | Audit section |+| ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------- | -------------------------------------------------------------- | ------------------------- |+| FR1, FR2 | `TabList.test.tsx` aria-current, polymorphic link, and tabs-pattern tests; `Tabs.a11y.test.tsx`; `Tabs.a11y.chromium.spec.ts` for `aria-selected` | Navigation, link, tabs | Wrong role or state fails. | `audit:Tab/accessibility` |+| FR3 | `TabList.test.tsx` single tab stop and roving tabindex tests | Selected | Extra tab stops, or a wrong starting stop, fail. | `audit:Tab/accessibility` |+| FR4, FR5 | `TabList.test.tsx` onChange and disabled tests | Click, disabled button | Selection when disabled fails. | `audit:Tab/behavior` |+| FR6, FR7 | `TabList.test.tsx` icon, icon-only, and pressed-overlay tests | Icon, selected icon, hidden label | Wrong icon, name, or overlay fails. | `audit:Tab/behavior` |+| RTL relation | RTL audit curated D2 target (`apps/storybook/rtl-audit/targets.json`) on `TabList / With icons` | Tab icon and label; LTR and RTL | An icon that is not at the inline start of its label fails D2. | `audit:Tab/i18n-rtl` |Read from source, with no focused test yet:diff --git a/docs/specs/components/TabList/TabMenu.spec.md b/docs/specs/components/TabList/TabMenu.spec.mdindex 9334617c82..4bc04d75d6 100644--- a/docs/specs/components/TabList/TabMenu.spec.md+++ b/docs/specs/components/TabList/TabMenu.spec.md@@ -14,6 +14,7 @@ verified_by:[packages/core/src/TabList/TabList.test.tsx,apps/storybook/stories/TabList.stories.tsx,+ apps/storybook/rtl-audit/targets.json,]modules: []families: [family:overlay-dismissal, family:action-groups]@@ -162,12 +163,13 @@ recorded.## Verification map-| Contract | Verification | Representative states | Mutation or failure expectation | Audit section |-| -------- | ------------------------------------------------------------------ | ------------------------------------------------- | -------------------------------------------- | ----------------------------- |-| FR1, FR3 | `TabList.test.tsx` TabMenu and host-attribute tests | Closed, open | Lost popup attributes fail. | `audit:TabMenu/accessibility` |-| FR2, FR4 | `TabList.test.tsx` TabMenu label, heading, and menuitemradio tests | Selected and unselected | Wrong label or missing `aria-checked` fails. | `audit:TabMenu/behavior` |-| FR5 | `TabList.test.tsx` TabMenu keyboard navigation tests | ArrowUp, ArrowDown, Home, End, Tab, Escape, Enter | Extra tab stops or a menu left open fails. | `audit:TabMenu/accessibility` |-| FR7 | `TabList.test.tsx` TabMenu suite (touch and mouse slides) | Touch and mouse slides across options | Removing the adoption fails the slide tests. | — |+| Contract | Verification | Representative states | Mutation or failure expectation | Audit section |+| ------------ | ---------------------------------------------------------------------------------------------- | ------------------------------------------------- | ---------------------------------------------------------------- | ----------------------------- |+| FR1, FR3 | `TabList.test.tsx` TabMenu and host-attribute tests | Closed, open | Lost popup attributes fail. | `audit:TabMenu/accessibility` |+| FR2, FR4 | `TabList.test.tsx` TabMenu label, heading, and menuitemradio tests | Selected and unselected | Wrong label or missing `aria-checked` fails. | `audit:TabMenu/behavior` |+| FR5 | `TabList.test.tsx` TabMenu keyboard navigation tests | ArrowUp, ArrowDown, Home, End, Tab, Escape, Enter | Extra tab stops or a menu left open fails. | `audit:TabMenu/accessibility` |+| FR7 | `TabList.test.tsx` TabMenu suite (touch and mouse slides) | Touch and mouse slides across options | Removing the adoption fails the slide tests. | — |+| RTL relation | RTL audit curated D2 target (`apps/storybook/rtl-audit/targets.json`) on `TabList / With menu` | Menu tab label and its chevron; LTR and RTL | A label that is not at the inline start of its chevron fails D2. | `audit:TabMenu/i18n-rtl` |Read from source, with no focused test yet:diff --git a/docs/specs/components/ToggleButton/ToggleButtonGroup.spec.md b/docs/specs/components/ToggleButton/ToggleButtonGroup.spec.mdindex c67188e3c8..2268c88d06 100644--- a/docs/specs/components/ToggleButton/ToggleButtonGroup.spec.md+++ b/docs/specs/components/ToggleButton/ToggleButtonGroup.spec.md@@ -16,6 +16,7 @@ verified_by:packages/core/src/ToggleButton/__tests__/ToggleButton.a11y.test.tsx,packages/core/src/ToggleButton/__tests__/ToggleButton.a11y.chromium.spec.ts,packages/core/src/Layer/layerScopedContext.test.tsx,+ apps/storybook/rtl-audit/targets.json,]modules: []families: [family:buttons]@@ -174,6 +175,7 @@ No design record governs ToggleButtonGroup. Its root carries the| FR8, FR9 (size and disabled) | Evidence gap: no test of member Tab order, or of size and disabled scoping at a layer | — | — | `audit:ToggleButtonGroup/accessibility` || FR7 (size), ORD2, PR1 | Evidence gap: no test asserts the group size default, member size precedence, or that the group adds no listeners beyond the press tracking `family:action-groups` FR5 gives it | — | — | `audit:ToggleButtonGroup/behavior` || AR2 | `ToggleButton.a11y.test.tsx` and `ToggleButton.a11y.chromium.spec.ts` operable and focusable facts for the single- and multiple-group states | Group members | A group member that is not operable or that Tab does not reach fails. | `audit:ToggleButtonGroup/accessibility` |+| RTL relation | RTL audit curated D2 target (`apps/storybook/rtl-audit/targets.json`) on `ToggleButton / Group single` | Two adjacent toggle buttons; LTR and RTL | An earlier button that is not at the inline start of the next fails D2. | `audit:ToggleButtonGroup/i18n-rtl` |## Current-state impact