Skip to content

An open source design system that's fully customizable and agent ready

TypeScript

test(rtl): RTL coverage for Stack, StackItem, HStack, VStack and Grid (#9303)

Cindy Zhangf885b8b29fd8
diff --git a/apps/storybook/rtl-audit/targets.json b/apps/storybook/rtl-audit/targets.json
index 2c787358c9..9eae72b2db 100644
--- a/apps/storybook/rtl-audit/targets.json
+++ b/apps/storybook/rtl-audit/targets.json
@@ -347,6 +347,66 @@
"next": "[data-testid=\"dropdown-menu-checkbox-item-end-content\"]"
}
},
+ {
+ "component": "Stack",
+ "storyId": "core-stack--horizontal",
+ "dims": ["D2"],
+ "selectors": {
+ "prev": ".astryx-stack > :first-child",
+ "next": ".astryx-stack > :nth-child(2)"
+ }
+ },
+ {
+ "component": "StackItem",
+ "storyId": "core-stack--stack-item-fill-size",
+ "dims": ["D2"],
+ "selectors": {
+ "prev": ".astryx-stack-item:first-child",
+ "next": ".astryx-stack-item:last-child"
+ }
+ },
+ {
+ "component": "HStack",
+ "storyId": "core-aspectratio--height-driven",
+ "dims": ["D2"],
+ "selectors": {
+ "prev": ".astryx-stack > :first-child",
+ "next": ".astryx-stack > :nth-child(2)"
+ }
+ },
+ {
+ "component": "VStack",
+ "storyId": "core-spinner--narrow-flex-host",
+ "dims": ["D4"],
+ "selectors": {
+ "overlay": "#storybook-root .astryx-stack > .astryx-stack:first-child",
+ "overlayRoot": "#storybook-root .astryx-stack:has(> .astryx-stack)"
+ }
+ },
+ {
+ "component": "Grid",
+ "storyId": "core-grid--with-grid-span",
+ "dims": ["D2"],
+ "selectors": {
+ "prev": ".astryx-grid > :first-child",
+ "next": ".astryx-grid > :nth-child(2)"
+ }
+ },
+ {
+ "component": "Spinner",
+ "storyId": "core-spinner--narrow-flex-host",
+ "dims": []
+ },
+ {
+ "component": "AspectRatio",
+ "storyId": "core-aspectratio--height-driven",
+ "dims": []
+ },
+ {
+ "component": "Stack",
+ "storyId": "core-stack--stack-item-fill-size",
+ "dims": []
+ },
{
"component": "DropdownMenu",
"storyId": "core-dropdownmenu--alignment-end",
diff --git a/docs/specs/components/Grid/Grid.spec.md b/docs/specs/components/Grid/Grid.spec.md
index 84f51f0fbf..9170217bd0 100644
--- a/docs/specs/components/Grid/Grid.spec.md
+++ b/docs/specs/components/Grid/Grid.spec.md
@@ -18,6 +18,7 @@ verified_by:
apps/storybook/stories/Grid.stories.tsx,
.github/scripts/story-play-guard.js,
packages/core/src/theme/themingTargets.test.ts,
+ apps/storybook/rtl-audit/targets.json,
]
modules: []
families: [family:layout-primitives]
@@ -171,6 +172,7 @@ wrapper's behavior.
| FR7, AR1, AR2 | `Grid.stories.tsx` AuditMatrix play guard in LTR and RTL | Fixed tracks in both directions | Items that do not run start to end in the document direction fail the play guard. Gap: no automated check asserts that Grid adds no role or keeps DOM order. | `audit:Grid/a11y-rtl` |
| PR1 | `serverSafeComponents.test.ts`; source review | Every state | A client API (state, an effect) added without a client directive fails `serverSafeComponents.test.ts`. Gap: a client API added together with a client directive passes, and no automated check fails if Grid adds layout measurement. | `audit:Grid/behavior` |
| Theming anatomy map | `scripts/check-knowledge.mjs` | Consumer anatomy and current targets | Missing, extra, or stale mappings fail repository validation. | `audit:Grid/theming` |
+| RTL relation | RTL audit curated D2 target (`apps/storybook/rtl-audit/targets.json`) on `Grid / With grid span` | Spanning and single-track items; LTR and RTL | A first grid item that is not at the inline start of the next fails D2. | `audit:Grid/i18n-rtl` |
## Decision log
diff --git a/docs/specs/components/Stack/Stack.spec.md b/docs/specs/components/Stack/Stack.spec.md
index 5390338ace..29e3ff0ffe 100644
--- a/docs/specs/components/Stack/Stack.spec.md
+++ b/docs/specs/components/Stack/Stack.spec.md
@@ -21,6 +21,7 @@ verified_by:
packages/core/src/theme/themingTargets.test.ts,
apps/storybook/stories/Stack.stories.tsx,
scripts/check-knowledge.mjs,
+ apps/storybook/rtl-audit/targets.json,
]
modules: []
families: [family:layout-primitives]
@@ -178,16 +179,17 @@ Consumer migration instructions belong in consumer docs and release notes.
## Verification map
-| Contract | Verification | Representative states | Mutation or failure expectation | Audit section |
-| ------------------- | ------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------- |
-| FR1, FR2 | `Stack.test.tsx`, `HStack.test.tsx`, `VStack.test.tsx` element tests; stable visual baseline `core-stack--default` | Default and `as` elements; default stack | A wrong default or `as` element fails; a changed default direction, gap, or alignment comes back changed for review. Gap: the direction, alignment, and alias tests assert only that content renders, so direction, `hAlign`/`vAlign` mapping, alias precedence, the `stack` target, and its reflection have no unit check. | `audit:Stack/layout` |
-| FR3 | `Stack.test.tsx` padding-precedence tests; `@astryx/no-physical-properties` lint rule | Uniform, axis, edge, all four edges | A missing padding class, edge over axis on the end edges, edge over uniform on the edges the tests pair, or a physical left/right padding property fails. Gap: edge over axis on the start edges, axis over uniform, any untested edge-over-uniform pairing, and the gap value (the gap test asserts only that content renders) have no check, and no browser right-to-left check covers the edges. | `audit:Stack/layout` |
-| FR5 | `Stack.test.tsx` sizing and scrolling tests | Numeric and string sizes; scrollable | A wrong computed width or height, or no class change for `isScrollable`, fails. Gap: `wrap`, `maxWidth`, `minHeight`, and size winning over caller `style` have no check. | `audit:Stack/layout` |
-| FR6 | `StackItem.test.tsx` element, scroll, and passthrough tests | Default and `as` elements; scrollable; `size="fill"` with scroll | A wrong element, or no class change for `isScrollable`, fails. Gap: the size and `crossAlignSelf` tests assert only that content renders, so the minimum-size reset, `static`, `fill`, cross alignment, and the `stack-item` target have no check. | `audit:Stack/layout` |
-| FR7 | Ref and pass-through tests in all four suites | Default and `as` elements | A dropped ref fails in all four suites, and a dropped `aria-label` in the Stack and StackItem suites (the HStack and VStack pass-through tests assert `data-testid` only). Gap: the ref tests accept any element, so a ref on a wrapper passes, and the styling-input merge order has no check. | `audit:Stack/behavior` |
-| FR4 | Source review against `architecture:container-padding` | Padded stack | Gap: no automated check fails if Stack publishes container-padding variables. | `audit:Stack/layout` |
-| Theming anatomy map | `scripts/check-knowledge.mjs` | Consumer anatomy and current targets | Missing, extra, or stale mappings fail repository validation. | `audit:Stack/theming` |
-| AR1, PR1 | `serverSafeComponents.test.ts`; source review | Every form | A client API (state, an effect, a context read) added without a client directive fails `serverSafeComponents.test.ts`. Gap: a client API added together with a client directive passes, and no automated check fails if Stack or StackItem adds a role. | `audit:Stack/behavior` |
+| Contract | Verification | Representative states | Mutation or failure expectation | Audit section |
+| ------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------- |
+| FR1, FR2 | `Stack.test.tsx`, `HStack.test.tsx`, `VStack.test.tsx` element tests; stable visual baseline `core-stack--default` | Default and `as` elements; default stack | A wrong default or `as` element fails; a changed default direction, gap, or alignment comes back changed for review. Gap: the direction, alignment, and alias tests assert only that content renders, so direction, `hAlign`/`vAlign` mapping, alias precedence, the `stack` target, and its reflection have no unit check. | `audit:Stack/layout` |
+| FR3 | `Stack.test.tsx` padding-precedence tests; `@astryx/no-physical-properties` lint rule | Uniform, axis, edge, all four edges | A missing padding class, edge over axis on the end edges, edge over uniform on the edges the tests pair, or a physical left/right padding property fails. Gap: edge over axis on the start edges, axis over uniform, any untested edge-over-uniform pairing, and the gap value (the gap test asserts only that content renders) have no check, and no browser right-to-left check covers the edges. | `audit:Stack/layout` |
+| FR5 | `Stack.test.tsx` sizing and scrolling tests | Numeric and string sizes; scrollable | A wrong computed width or height, or no class change for `isScrollable`, fails. Gap: `wrap`, `maxWidth`, `minHeight`, and size winning over caller `style` have no check. | `audit:Stack/layout` |
+| FR6 | `StackItem.test.tsx` element, scroll, and passthrough tests | Default and `as` elements; scrollable; `size="fill"` with scroll | A wrong element, or no class change for `isScrollable`, fails. Gap: the size and `crossAlignSelf` tests assert only that content renders, so the minimum-size reset, `static`, `fill`, cross alignment, and the `stack-item` target have no check. | `audit:Stack/layout` |
+| FR7 | Ref and pass-through tests in all four suites | Default and `as` elements | A dropped ref fails in all four suites, and a dropped `aria-label` in the Stack and StackItem suites (the HStack and VStack pass-through tests assert `data-testid` only). Gap: the ref tests accept any element, so a ref on a wrapper passes, and the styling-input merge order has no check. | `audit:Stack/behavior` |
+| FR4 | Source review against `architecture:container-padding` | Padded stack | Gap: no automated check fails if Stack publishes container-padding variables. | `audit:Stack/layout` |
+| Theming anatomy map | `scripts/check-knowledge.mjs` | Consumer anatomy and current targets | Missing, extra, or stale mappings fail repository validation. | `audit:Stack/theming` |
+| AR1, PR1 | `serverSafeComponents.test.ts`; source review | Every form | A client API (state, an effect, a context read) added without a client directive fails `serverSafeComponents.test.ts`. Gap: a client API added together with a client directive passes, and no automated check fails if Stack or StackItem adds a role. | `audit:Stack/behavior` |
+| RTL relation | RTL audit curated targets (`apps/storybook/rtl-audit/targets.json`): Stack and StackItem D2 on `Stack / Horizontal` and `Stack / StackItem fill size`, HStack D2 on `AspectRatio / Height driven`, VStack D4 on `Spinner / Narrow flex host` | Horizontal stacks, static and fill items, and a start-aligned vertical stack; LTR and RTL | A horizontal stack whose first child is not at the inline start, or a start-aligned vertical stack child that does not move to the mirrored side, fails D2 or D4. | `audit:Stack/i18n-rtl` |
## Decision log