An open source design system that's fully customizable and agent ready
TypeScript
test(rtl): RTL coverage for list, metadata, radio, selector and typeahead rows (#9308)
Cindy Zhang2406addf5bb7
diff --git a/apps/storybook/rtl-audit/targets.json b/apps/storybook/rtl-audit/targets.jsonindex 3719979ef8..3dd9f037fd 100644--- a/apps/storybook/rtl-audit/targets.json+++ b/apps/storybook/rtl-audit/targets.json@@ -482,6 +482,82 @@"next": ".astryx-stepper > li:last-child"}},+ {+ "component": "ListItem",+ "storyId": "core-list--interactive",+ "dims": ["D2"],+ "selectors": {+ "prev": ".astryx-list-item:first-child > :first-child",+ "next": ".astryx-list-item:first-child > :last-child"+ }+ },+ {+ "component": "MetadataList",+ "storyId": "core-metadatalist--basic",+ "dims": ["D2"],+ "selectors": {+ "prev": ".astryx-metadata-list dl > dt:first-of-type",+ "next": ".astryx-metadata-list dl > dd:first-of-type"+ }+ },+ {+ "component": "MetadataListItem",+ "storyId": "core-metadatalist--basic",+ "dims": ["D2"],+ "selectors": {+ "prev": ".astryx-metadata-list-item:first-child",+ "next": ".astryx-metadata-list-item:first-child + dd"+ }+ },+ {+ "component": "RadioListItem",+ "storyId": "core-radiolist--default",+ "dims": ["D2"],+ "selectors": {+ "prev": ".astryx-radio-list-item:first-child .astryx-radio-indicator",+ "next": ".astryx-radio-list-item:first-child span:text-is(\"Email\")"+ }+ },+ {+ "component": "SelectorOption",+ "storyId": "core-selector--with-icons",+ "dims": ["D2"],+ "setup": {"click": "[role=\"combobox\"]"},+ "selectors": {+ "prev": ".astryx-selector-option > span:first-child",+ "next": ".astryx-selector-option > span:nth-child(2)"+ }+ },+ {+ "component": "TypeaheadItem",+ "storyId": "core-typeahead--item-with-icon",+ "dims": ["D2"],+ "setup": {"click": "[role=\"combobox\"]"},+ "selectors": {+ "prev": ".astryx-typeahead-item > :first-child",+ "next": ".astryx-typeahead-item > :last-child"+ }+ },+ {+ "component": "List",+ "storyId": "core-list--interactive",+ "dims": []+ },+ {+ "component": "RadioList",+ "storyId": "core-radiolist--default",+ "dims": []+ },+ {+ "component": "Selector",+ "storyId": "core-selector--with-icons",+ "dims": []+ },+ {+ "component": "Typeahead",+ "storyId": "core-typeahead--item-with-icon",+ "dims": []+ },{"component": "Switch","storyId": "core-switch--on",diff --git a/apps/storybook/stories/Typeahead.stories.tsx b/apps/storybook/stories/Typeahead.stories.tsxindex b007b4d116..1d20864c8b 100644--- a/apps/storybook/stories/Typeahead.stories.tsx+++ b/apps/storybook/stories/Typeahead.stories.tsx@@ -3,7 +3,7 @@import {useState} from 'react';import type {Meta, StoryObj} from '@storybook/react';import {expect, userEvent, waitFor, within} from 'storybook/test';-import {Typeahead} from '@astryxdesign/core/Typeahead';+import {Typeahead, TypeaheadItem} from '@astryxdesign/core/Typeahead';import type {SearchableItem, SearchSource} from '@astryxdesign/core/Typeahead';import {MagnifyingGlassIcon} from '@heroicons/react/24/outline';@@ -132,6 +132,27 @@ export const WithBootstrap: Story = {name: 'With Bootstrap Results',};+/**+ * Fixture for the RTL audit: results rendered through TypeaheadItem with a+ * leading icon and a description, so the item's icon-then-content order can+ * be measured in both directions.+ */+export const ItemWithIcon: Story = {+ ...Default,+ args: {+ ...Default.args,+ hasEntriesOnFocus: true,+ renderItem: (item: SearchableItem) => (+ <TypeaheadItem+ item={item}+ description="Fruit"+ icon={<MagnifyingGlassIcon width={16} height={16} aria-hidden="true" />}+ />+ ),+ },+ name: 'Parts / TypeaheadItem with icon',+};+export const Required: Story = {...Default,args: {diff --git a/docs/specs/components/List/ListItem.spec.md b/docs/specs/components/List/ListItem.spec.mdindex 116873ffa2..55611c9316 100644--- a/docs/specs/components/List/ListItem.spec.md+++ b/docs/specs/components/List/ListItem.spec.md@@ -15,6 +15,7 @@ verified_by:packages/core/src/List/List.test.tsx,packages/core/src/theme/themingTargets.test.ts,scripts/check-knowledge.mjs,+ apps/storybook/rtl-audit/targets.json,]modules: []families: [family:navigation-destinations]@@ -173,13 +174,14 @@ migration, so the map is deferred.## Verification map-| Contract | Verification | Representative states | Mutation or failure expectation | Audit section |-| -------- | -------------------------------------------------------------------------------- | ---------------------------------------------- | ------------------------------------------------------ | ------------------------------ |-| FR1, AR1 | `List.test.tsx` row element, align, data attribute, and swipe pass-through tests | Static and interactive rows | A row that is not an `<li>`, or a dropped prop, fails. | `audit:ListItem/behavior` |-| FR2 | `List.test.tsx` density, divider, radius, and edge treatment tests | Each density; dividers on and off; each edge | A row that ignores its List's settings fails. | `audit:ListItem/layout` |-| FR3 | `List.test.tsx` "keeps the inset of a ListItem outside a List" | Row outside a List | A row outside a List that loses its inset fails. | `audit:ListItem/layout` |-| FR4, AR3 | `List.test.tsx` marker and ListMarkerScope tests | Presence of a marker, none, scope marker, task | A missing, extra, or unlabelled marker fails. | `audit:ListItem/anatomy` |-| AR2 | `List.test.tsx` invisible button, anchor, disabled, and selection tests | Click, href, disabled, selected | Lost row semantics fail. | `audit:ListItem/accessibility` |+| Contract | Verification | Representative states | Mutation or failure expectation | Audit section |+| ------------ | --------------------------------------------------------------------------------------------- | ---------------------------------------------- | ---------------------------------------------------------------------------- | ------------------------------ |+| FR1, AR1 | `List.test.tsx` row element, align, data attribute, and swipe pass-through tests | Static and interactive rows | A row that is not an `<li>`, or a dropped prop, fails. | `audit:ListItem/behavior` |+| FR2 | `List.test.tsx` density, divider, radius, and edge treatment tests | Each density; dividers on and off; each edge | A row that ignores its List's settings fails. | `audit:ListItem/layout` |+| FR3 | `List.test.tsx` "keeps the inset of a ListItem outside a List" | Row outside a List | A row outside a List that loses its inset fails. | `audit:ListItem/layout` |+| FR4, AR3 | `List.test.tsx` marker and ListMarkerScope tests | Presence of a marker, none, scope marker, task | A missing, extra, or unlabelled marker fails. | `audit:ListItem/anatomy` |+| AR2 | `List.test.tsx` invisible button, anchor, disabled, and selection tests | Click, href, disabled, selected | Lost row semantics fail. | `audit:ListItem/accessibility` |+| RTL relation | RTL audit curated D2 target (`apps/storybook/rtl-audit/targets.json`) on `List / Interactive` | Start icon and end chevron; LTR and RTL | A start content that is not at the inline start of the end content fails D2. | `audit:ListItem/i18n-rtl` |Read from source, with no focused test yet:diff --git a/docs/specs/components/MetadataList/MetadataList.spec.md b/docs/specs/components/MetadataList/MetadataList.spec.mdindex 6f30ce3ad0..c281e6e66e 100644--- a/docs/specs/components/MetadataList/MetadataList.spec.md+++ b/docs/specs/components/MetadataList/MetadataList.spec.md@@ -16,6 +16,7 @@ verified_by:packages/core/src/theme/themingTargets.test.ts,.github/visual-baseline/manifest.json,scripts/check-knowledge.mjs,+ apps/storybook/rtl-audit/targets.json,]modules: []families: []@@ -172,6 +173,7 @@ here; the Title, value cell, and Disclosure carry no target.| FR5 | `MetadataList.test.tsx` root pass-through, event, and owned-metadata tests | `aria-label`, `id`, data; click; colliding reflection | A dropped attribute or handler, or a caller `data-columns` or `data-orientation` that wins, fails. Gap: no test covers `ref`, `className`, `style`, or the `xstyle` merge order. | `audit:MetadataList/api` || PR1 | Source review | Every state | Gap: no automated check fails if MetadataList adds a listener, timer, or measurement. | `audit:MetadataList/behavior` || Theming targets | `themingTargets.test.ts` | Root and item targets | A renamed or undocumented target fails. Gap: no check fails if the side-by-side `dt` loses the `metadata-list-item` target. | `audit:MetadataList/theming` |+| RTL relation | RTL audit curated D2 target (`apps/storybook/rtl-audit/targets.json`) on `MetadataList / Basic` | Side labels; LTR and RTL | A label column that is not at the inline start of the value column fails D2. | `audit:MetadataList/i18n-rtl` |## Decision logdiff --git a/docs/specs/components/MetadataList/MetadataListItem.spec.md b/docs/specs/components/MetadataList/MetadataListItem.spec.mdindex e036b1fa9d..fb79c50644 100644--- a/docs/specs/components/MetadataList/MetadataListItem.spec.md+++ b/docs/specs/components/MetadataList/MetadataListItem.spec.md@@ -14,6 +14,7 @@ verified_by:[packages/core/src/MetadataList/MetadataList.test.tsx,scripts/check-knowledge.mjs,+ apps/storybook/rtl-audit/targets.json,]modules: []families: []@@ -142,14 +143,15 @@ its own, so no anatomy-theming block is declared here.## Verification map-| Contract | Verification | Representative states | Mutation or failure expectation | Audit section |-| -------- | ------------------------------------------------------------------------ | ------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------- |-| FR1 | `MetadataList.test.tsx` item, label-width, and pass-through-target tests | Side by side | A missing label or value, a `dt` or `dd` that is not a direct child of the `dl`, wrong `-label` and `-value` test ids, or props or click handling that leave the `dt`, fails. Gap: no test attaches a `ref`, and the 24px minimum height has no check. No check fails if the side-by-side `dt` loses the `metadata-list-item` target. | `audit:MetadataListItem/layout` |-| FR2 | `MetadataList.test.tsx` stacked and stacked pass-through tests | Stacked | A missing wrapper, `dt`, or `dd`, or props that leave the wrapper, fails. Gap: the stacked gap has no check. No test attaches a `ref` to the stacked wrapper. | `audit:MetadataListItem/layout` |-| FR3 | `MetadataList.test.tsx` icon test | With icon | A missing icon fails. Gap: label and value type and color and the icon gap have no automated check. | `audit:MetadataListItem/design` |-| FR4 | `MetadataList.test.tsx` pass-through tests | `aria-label`, `id`, data; click | A dropped attribute or handler fails. Gap: no test covers `className`, `style`, or the `xstyle` merge order. | `audit:MetadataListItem/api` |-| AR1 | `MetadataList.test.tsx` role queries | Term and definition | A missing `term` or `definition` role in the DOM fails. Gap: no accessibility-tree check proves the pairing (`spec:AST-009` FR3). | `audit:MetadataListItem/a11y` |-| PR1 | Source review | Every state | Gap: no automated check fails if MetadataListItem adds state. | `audit:MetadataListItem/behavior` |+| Contract | Verification | Representative states | Mutation or failure expectation | Audit section |+| ------------ | ----------------------------------------------------------------------------------------------- | --------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------- |+| FR1 | `MetadataList.test.tsx` item, label-width, and pass-through-target tests | Side by side | A missing label or value, a `dt` or `dd` that is not a direct child of the `dl`, wrong `-label` and `-value` test ids, or props or click handling that leave the `dt`, fails. Gap: no test attaches a `ref`, and the 24px minimum height has no check. No check fails if the side-by-side `dt` loses the `metadata-list-item` target. | `audit:MetadataListItem/layout` |+| FR2 | `MetadataList.test.tsx` stacked and stacked pass-through tests | Stacked | A missing wrapper, `dt`, or `dd`, or props that leave the wrapper, fails. Gap: the stacked gap has no check. No test attaches a `ref` to the stacked wrapper. | `audit:MetadataListItem/layout` |+| FR3 | `MetadataList.test.tsx` icon test | With icon | A missing icon fails. Gap: label and value type and color and the icon gap have no automated check. | `audit:MetadataListItem/design` |+| FR4 | `MetadataList.test.tsx` pass-through tests | `aria-label`, `id`, data; click | A dropped attribute or handler fails. Gap: no test covers `className`, `style`, or the `xstyle` merge order. | `audit:MetadataListItem/api` |+| AR1 | `MetadataList.test.tsx` role queries | Term and definition | A missing `term` or `definition` role in the DOM fails. Gap: no accessibility-tree check proves the pairing (`spec:AST-009` FR3). | `audit:MetadataListItem/a11y` |+| PR1 | Source review | Every state | Gap: no automated check fails if MetadataListItem adds state. | `audit:MetadataListItem/behavior` |+| RTL relation | RTL audit curated D2 target (`apps/storybook/rtl-audit/targets.json`) on `MetadataList / Basic` | Side label and value; LTR and RTL | A label that is not at the inline start of its value fails D2. | `audit:MetadataListItem/i18n-rtl` |## Decision logdiff --git a/docs/specs/components/RadioList/RadioListItem.spec.md b/docs/specs/components/RadioList/RadioListItem.spec.mdindex 1e1470a957..699f618ef7 100644--- a/docs/specs/components/RadioList/RadioListItem.spec.md+++ b/docs/specs/components/RadioList/RadioListItem.spec.md@@ -29,6 +29,7 @@ verified_by:packages/core/src/RadioList/RadioListItem.press.source-build.test.mjs,packages/core/src/RadioList/__tests__/RadioGroup.a11y.test.tsx,packages/core/src/RadioList/__tests__/RadioGroup.a11y.chromium.spec.ts,+ apps/storybook/rtl-audit/targets.json,]modules: []families: []@@ -188,6 +189,7 @@ No design record beyond `design:user-states` governs RadioListItem.| FR9, FR10, AR3, AR4 | `RadioList.test.tsx` coarse-pointer, RTL, and forced-colors cases | Coarse pointer; RTL; forced colors | Evidence gap: the forced-colors case passes on any matching rule (the checkbox mark supplies one), so it does not prove the dot; the coarse-pointer and RTL cases check only the direction-symmetric centering class, not the 24 by 24 minimum or RTL placement. | `audit:RadioListItem/accessibility` || FR11, FR12 | `RadioList.test.tsx` theme-target and rest-forwarding cases | Sizes; selected; disabled | A target off the painted row, or a missing state, fails. Evidence gap: no test asserts `ref`, `className`, `style`, or `xstyle` on the row. | `audit:RadioListItem/theming` || PR1 | Evidence gap: no test asserts the absence of observers or global listeners | — | — | `audit:RadioListItem/behavior` |+| RTL relation | RTL audit curated D2 target (`apps/storybook/rtl-audit/targets.json`) on `RadioList / Default` | Indicator and label; LTR and RTL | An indicator that is not at the inline start of its label fails D2. | `audit:RadioListItem/i18n-rtl` |## Current-state impactdiff --git a/docs/specs/components/Selector/SelectorOption.spec.md b/docs/specs/components/Selector/SelectorOption.spec.mdindex c4358436bf..43b75021dd 100644--- a/docs/specs/components/Selector/SelectorOption.spec.md+++ b/docs/specs/components/Selector/SelectorOption.spec.md@@ -10,7 +10,11 @@ approved_by: cixzhangapproved_at: 2026-11-01owners: [cixzhang]review_triggers: [public-api, layout, theming]-verified_by: [packages/core/src/Selector/Selector.test.tsx]+verified_by:+ [+ packages/core/src/Selector/Selector.test.tsx,+ apps/storybook/rtl-audit/targets.json,+ ]modules: []families: []design_specs: []@@ -142,13 +146,14 @@ map.## Verification map-| Contract | Verification | Representative states | Mutation or failure expectation | Audit section |-| -------------------- | ------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------- |-| FR1 | `Selector.test.tsx` "renders custom option endContent" and "renders the selected option through renderValue" | Option with end content; value with icon and description | A dropped end content, label, description, or icon fails. Evidence gap: no test asserts the small secondary presentation of a semantic icon name or icon component. | `audit:SelectorOption/anatomy` |-| FR2 | `Selector.test.tsx` "follows the caller's SelectorOption layout, but folds inline in a group" | Standalone trigger; trigger in an InputGroup | A stacked row in an InputGroup, or an inline row standalone by default, fails. Evidence gap: no test passes `layout="inline"` outside an InputGroup. | `audit:SelectorOption/layout` |-| FR3 | `Selector.test.tsx` "lets a narrow list shrink an option so its label can ellipsize" | Default option in a narrow list | A missing `selector-option` row or a nonzero minimum width fails. Evidence gap: no test asserts the padding and radius reset, or `xstyle`, `className`, and `style` on the row. | `audit:SelectorOption/theming` |-| ORD1, ORD2, PR1, AR1 | ORD1 is covered by the FR2 row. Evidence gap: no test asserts ORD2, PR1, or the decorative icon | — | — | `audit:SelectorOption/behavior` |-| FR4 | Evidence gap: no test, matching the FR4 gap | — | — | `audit:SelectorOption/api` |+| Contract | Verification | Representative states | Mutation or failure expectation | Audit section |+| -------------------- | --------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------- |+| FR1 | `Selector.test.tsx` "renders custom option endContent" and "renders the selected option through renderValue" | Option with end content; value with icon and description | A dropped end content, label, description, or icon fails. Evidence gap: no test asserts the small secondary presentation of a semantic icon name or icon component. | `audit:SelectorOption/anatomy` |+| FR2 | `Selector.test.tsx` "follows the caller's SelectorOption layout, but folds inline in a group" | Standalone trigger; trigger in an InputGroup | A stacked row in an InputGroup, or an inline row standalone by default, fails. Evidence gap: no test passes `layout="inline"` outside an InputGroup. | `audit:SelectorOption/layout` |+| FR3 | `Selector.test.tsx` "lets a narrow list shrink an option so its label can ellipsize" | Default option in a narrow list | A missing `selector-option` row or a nonzero minimum width fails. Evidence gap: no test asserts the padding and radius reset, or `xstyle`, `className`, and `style` on the row. | `audit:SelectorOption/theming` |+| ORD1, ORD2, PR1, AR1 | ORD1 is covered by the FR2 row. Evidence gap: no test asserts ORD2, PR1, or the decorative icon | — | — | `audit:SelectorOption/behavior` |+| FR4 | Evidence gap: no test, matching the FR4 gap | — | — | `audit:SelectorOption/api` |+| RTL relation | RTL audit curated D2 target (`apps/storybook/rtl-audit/targets.json`) on `Selector / With icons` (popup opened) | Icon and label in an open option; LTR and RTL | An option icon that is not at the inline start of its label fails D2. | `audit:SelectorOption/i18n-rtl` |## Current-state impactdiff --git a/docs/specs/components/Typeahead/TypeaheadItem.spec.md b/docs/specs/components/Typeahead/TypeaheadItem.spec.mdindex ce6593dc6d..a88fa7b1e1 100644--- a/docs/specs/components/Typeahead/TypeaheadItem.spec.md+++ b/docs/specs/components/Typeahead/TypeaheadItem.spec.md@@ -10,7 +10,11 @@ approved_by: cixzhangapproved_at: 2026-11-01owners: [cixzhang]review_triggers: [public-api, theming]-verified_by: [packages/core/src/Typeahead/TypeaheadItem.test.tsx]+verified_by:+ [+ packages/core/src/Typeahead/TypeaheadItem.test.tsx,+ apps/storybook/rtl-audit/targets.json,+ ]modules: []families: []design_specs: []@@ -130,13 +134,14 @@ carries no anatomy-theming map.## Verification map-| Contract | Verification | Representative states | Mutation or failure expectation | Audit section |-| --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------ |-| FR1 | `TypeaheadItem.test.tsx` "renders the item label", "renders the description below the label when provided", "renders no description element when none is provided", "renders the icon before the label content" | Label, description, icon | A missing label, description, or icon, an extra description element, or the icon after the label fails. | `audit:TypeaheadItem/anatomy` |-| FR2 | `TypeaheadItem.test.tsx` "dims the row when isDisabled is set" and "does not dim the row by default" | Enabled and disabled | Missing or default dimming fails. Evidence gap: no test asserts the `typeahead-item` class. | `audit:TypeaheadItem/theming` |-| FR3 | `TypeaheadItem.test.tsx` "forwards pass-through props to the item element", "merges a caller className with its own classes", "forwards ref to the row element" | Pass-through, className, ref | A dropped prop, class, or ref fails. Evidence gap: no test asserts `style` or `xstyle`. | `audit:TypeaheadItem/api` |-| FR4, ORD1 | `TypeaheadItem.test.tsx` "renders item.element raw in place of the label layout" | `item.element` | An element that keeps the default layout fails. Evidence gap: no test asserts the root inputs on this path (the FR4 gap). | `audit:TypeaheadItem/api` |-| PR1, AR1 | Evidence gap: no test asserts the absence of lifecycle resources or roles | — | — | `audit:TypeaheadItem/behavior` |+| Contract | Verification | Representative states | Mutation or failure expectation | Audit section |+| ------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------ |+| FR1 | `TypeaheadItem.test.tsx` "renders the item label", "renders the description below the label when provided", "renders no description element when none is provided", "renders the icon before the label content" | Label, description, icon | A missing label, description, or icon, an extra description element, or the icon after the label fails. | `audit:TypeaheadItem/anatomy` |+| FR2 | `TypeaheadItem.test.tsx` "dims the row when isDisabled is set" and "does not dim the row by default" | Enabled and disabled | Missing or default dimming fails. Evidence gap: no test asserts the `typeahead-item` class. | `audit:TypeaheadItem/theming` |+| FR3 | `TypeaheadItem.test.tsx` "forwards pass-through props to the item element", "merges a caller className with its own classes", "forwards ref to the row element" | Pass-through, className, ref | A dropped prop, class, or ref fails. Evidence gap: no test asserts `style` or `xstyle`. | `audit:TypeaheadItem/api` |+| FR4, ORD1 | `TypeaheadItem.test.tsx` "renders item.element raw in place of the label layout" | `item.element` | An element that keeps the default layout fails. Evidence gap: no test asserts the root inputs on this path (the FR4 gap). | `audit:TypeaheadItem/api` |+| PR1, AR1 | Evidence gap: no test asserts the absence of lifecycle resources or roles | — | — | `audit:TypeaheadItem/behavior` |+| RTL relation (FR1) | RTL audit curated D2 target (`apps/storybook/rtl-audit/targets.json`) on `Typeahead / Parts / TypeaheadItem with icon` (results opened) | Icon, label and description in an open result; LTR and RTL | A result icon that is not at the inline start of its content fails D2. | `audit:TypeaheadItem/i18n-rtl` |## Current-state impact