chore(link): add link vrt coverage - #6582
Conversation
|
📚 Branch Preview Links🔍 Gen1 Visual Regression Test ResultsWhen a visual regression test fails (or has previously failed while working on this branch), its results can be found in the following URLs:
Deployed to Azure Blob Storage: If the changes are expected, update the |
rise-erpelding
left a comment
There was a problem hiding this comment.
The VRTs look good!
One tiny thing we might also consider, the migration plan included checklist items for VRTs that we could check off (although... how useful is the migration plan at this point really?):
- VRT: default / secondary / quiet / static black / static white × hover / focus-visible (per
link.css+ prose / wrapper stories)- VRT: links inside running text vs section / quiet stories (paired modifiers per plan)
I think all of this is covered except for the links inside running text, which seems more like typography's responsibility?
Description
Adds visual regression test (VRT) coverage for the 2nd-gen Link component (
components/link). Link is a CSS-only utility (a native<a>styled bylink.css's.swc-LinkBEM modifiers, imported page-level inpreview.ts), so it has no custom element and no shadow root. Coverage is delivered as two new.vrt.tsfiles, following the existing VRT patterns in the package. No component, behavior, or DOM changes — test-only.test/vrt/link.vrt.ts— permutationsTwo snapshots off a shared
permutationContent():Permutations(rendered light/ltr + dark/rtl in one story): inline variants (default / secondary), standalone, quiet standalone (rest + forced-hover, to show the underline returning), all four interaction states (rest / hover / active / focus-visible) for both default and secondary, CJK line-height (ja/ko/zh), and static white/black variants + states on their matching contrast backgrounds viastaticColorBackground.ForcedColors: same content underforced-colors: active(its own snapshot, since it repaints the whole page palette).Forced pseudo-states are mirrored from
document.styleSheetsviaforcePseudoStates('.swc-Link[data-force-state]')(the plain-element path — no shadow root), matching the button global-styles VRT.test/vrt/link-custom-properties.vrt.ts— custom propertiesOne reference-vs-override row per documented
--swc-link-*custom property (magentaoverrides, obviously distinct from the default tokens), with the state-scoped color properties forced into the interaction state they resolve in (hover/active/focus-visible).Motivation and context
The Link component shipped without dedicated VRT stories. This closes that gap so regressions in link color variants, standalone/quiet modifiers, interaction states, CJK line-height, static colors, forced-colors, and the documented custom properties are caught by Chromatic.
Related issue(s)
Screenshots (if appropriate)
N/A — the visual coverage this PR adds is captured as Chromatic VRT snapshots rather than static screenshots.
Author's checklist
Reviewer's checklist
patch,minor, ormajorfeaturesManual review test cases
New Link VRT stories render correctly across themes and states
Forced-colors and custom-property coverage
forced-colors: active.--swc-link-*row, confirm the override cell is visiblymagentaand clearly different from the reference cell.Custom propertiesstoryplayfunction to pass (coverage assertion green).Device review
Accessibility testing checklist
This is a test-only PR that adds VRT stories; it does not change the Link component's markup, semantics, or behavior. The steps below verify the added stories rather than new component behavior.
Keyboard (required — document steps below) — What to test for: focus indicator is visible; no focus traps.
focus-visibleVRT row); no focus traps; tab order follows document order.Screen reader (required — document steps below) — What to test for: role and name announced correctly.