Skip to content

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

TypeScript

test(rtl): RTL coverage for TopNavMegaMenuFeaturedCard (#9380)

Cindy Zhangdaa87e1368b7
diff --git a/apps/storybook/rtl-audit/targets.json b/apps/storybook/rtl-audit/targets.json
index 4269647267..38d11b5bf5 100644
--- a/apps/storybook/rtl-audit/targets.json
+++ b/apps/storybook/rtl-audit/targets.json
@@ -1218,5 +1218,19 @@
"component": "InputGroup",
"storyId": "core-inputgroup--with-prefix",
"dims": []
+ },
+ {
+ "component": "TopNavMegaMenuFeaturedCard",
+ "storyId": "core-topnavmenu--featured-card-link-arrow",
+ "dims": ["D4"],
+ "selectors": {
+ "overlay": ".astryx-top-nav-mega-menu-featured-card a > span",
+ "overlayRoot": ".astryx-top-nav-mega-menu-featured-card a"
+ }
+ },
+ {
+ "component": "TopNavMenu",
+ "storyId": "core-topnavmenu--featured-card-link-arrow",
+ "dims": []
}
]
diff --git a/apps/storybook/stories/TopNavMenu.stories.tsx b/apps/storybook/stories/TopNavMenu.stories.tsx
index a974a4b67d..613e1f1d00 100644
--- a/apps/storybook/stories/TopNavMenu.stories.tsx
+++ b/apps/storybook/stories/TopNavMenu.stories.tsx
@@ -312,3 +312,21 @@ export const MegaMenuSimple: Story = {
</div>
),
};
+
+/**
+ * Fixture for the RTL audit: a featured card shrink-wrapped to its link, so the
+ * link box is the label and its arrow, and the arrow's side of the label can be
+ * measured in both directions.
+ */
+export const FeaturedCardLinkArrow: Story = {
+ name: 'Featured card / Link arrow',
+ render: () => (
+ <div style={{width: 'max-content'}}>
+ <TopNavMegaMenuFeaturedCard
+ title="New"
+ linkLabel="Read the announcement"
+ linkHref="#announcement"
+ />
+ </div>
+ ),
+};
diff --git a/docs/specs/components/TopNav/TopNavMegaMenuFeaturedCard.spec.md b/docs/specs/components/TopNav/TopNavMegaMenuFeaturedCard.spec.md
index ab1fdc8c5b..2606773f42 100644
--- a/docs/specs/components/TopNav/TopNavMegaMenuFeaturedCard.spec.md
+++ b/docs/specs/components/TopNav/TopNavMegaMenuFeaturedCard.spec.md
@@ -10,7 +10,12 @@ approved_by: cixzhang
approved_at: 2026-10-25
owners: [cixzhang]
review_triggers: [public-api, behavior, accessibility]
-verified_by: [packages/core/src/TopNav/TopNav.test.tsx]
+verified_by:
+ [
+ packages/core/src/TopNav/TopNav.test.tsx,
+ apps/storybook/rtl-audit/targets.json,
+ apps/storybook/stories/TopNavMenu.stories.tsx,
+ ]
modules: []
families: [family:navigation-destinations]
design_specs: [design:bidirectionality]
@@ -126,11 +131,12 @@ anatomy-theming map is recorded.
## Verification map
-| Contract | Verification | Representative states | Mutation or failure expectation | Audit section |
-| --------------- | ----------------------------------------------------------------------------- | ------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------ |
-| FR1 | `TopNav.test.tsx` featured-card rest-forwarding test | Root props | Dropped props fail. | `audit:TopNavMegaMenuFeaturedCard/behavior` |
-| FR2, FR3 | `TopNav.test.tsx` featured-card image tests | With and without `imageAlt` | Exposed decorative image or lost link fails. | `audit:TopNavMegaMenuFeaturedCard/accessibility` |
-| FR3 (RTL arrow) | `TopNav.test.tsx` featured-card arrow-mirror test, plus real-browser evidence | Link with a label, LTR and RTL | An arrow that points right in RTL, or a link name that changes, fails. Gap: the unit test sees the mirror class but not the inline-block box the transform needs; no committed browser check fails on an unmirrored arrow. | `audit:TopNavMegaMenuFeaturedCard/i18n-rtl` |
+| Contract | Verification | Representative states | Mutation or failure expectation | Audit section |
+| ------------------ | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------ |
+| FR1 | `TopNav.test.tsx` featured-card rest-forwarding test | Root props | Dropped props fail. | `audit:TopNavMegaMenuFeaturedCard/behavior` |
+| FR2, FR3 | `TopNav.test.tsx` featured-card image tests | With and without `imageAlt` | Exposed decorative image or lost link fails. | `audit:TopNavMegaMenuFeaturedCard/accessibility` |
+| FR3 (RTL arrow) | `TopNav.test.tsx` featured-card arrow-mirror test, plus real-browser evidence | Link with a label, LTR and RTL | An arrow that points right in RTL, or a link name that changes, fails. Gap: the unit test sees the mirror class but not the inline-block box the transform needs; no committed browser check fails on an unmirrored arrow. | `audit:TopNavMegaMenuFeaturedCard/i18n-rtl` |
+| RTL relation (FR3) | RTL audit curated D4 target (`apps/storybook/rtl-audit/targets.json`) on `TopNavMenu / Featured card / Link arrow` | The link arrow against its label (the fixture link box is the label and arrow); LTR and RTL | An arrow that keeps its LTR side of the label in RTL fails D4. The glyph mirror itself is covered by the FR3 (RTL arrow) row. | `audit:TopNavMegaMenuFeaturedCard/i18n-rtl` |
Read from source, with no focused test yet: the content order (FR1); the forwarded `ref` and the `top-nav-mega-menu-featured-card` target (FR1); that the link renders only when both `linkLabel` and `linkHref` are set (FR3); the image size (FR1), the `LinkProvider` link (FR3), and FR4.