test(action-group): add unit, accessibility, and VRT coverage - #6589
test(action-group): add unit, accessibility, and VRT coverage#6589rise-erpelding wants to merge 5 commits into
Conversation
|
0cc1e2c to
613bade
Compare
There was a problem hiding this comment.
Compact action groups need to be able to modify the action button corner radii, this adds VRT testing for those
| const staticColorsContent = () => | ||
| ACTION_GROUP_STATIC_COLORS.map((staticColor) => | ||
| staticColorBackground( | ||
| row([renderGroup({ staticColor })], `Static ${staticColor}`), | ||
| staticColor | ||
| ) | ||
| ); |
There was a problem hiding this comment.
Is it necessary to test static colors here? We're already testing them in action button, it doesn't seem likely that anything about action group would change those test results. Debated taking it out but figured I'd gather opinions first.
9a284f0 to
0737283
Compare
cdransf
left a comment
There was a problem hiding this comment.
One small question! Looks great! ✨
| }: { | ||
| canvasElement: HTMLElement; | ||
| }) => { | ||
| canvasElement.querySelector<HTMLElement>('[data-vrt-focus-target]')?.focus(); |
There was a problem hiding this comment.
Do we need something like this if Permutations on 238 renders the same permutation content twice? (Each with its own [data-vrt-focus-target].)
| canvasElement.querySelector<HTMLElement>('[data-vrt-focus-target]')?.focus(); | |
| const focusMiddleChild = ({ canvasElement }: { canvasElement: HTMLElement }) => { | |
| canvasElement | |
| .querySelectorAll<HTMLElement>('[data-vrt-focus-target]') | |
| .forEach((el) => el.focus()); | |
| }; |
Description
Adds Phase 6 test coverage for the 2nd-gen
swc-action-groupmigration:action-group.test.ts): defaults, ARIA attributes, roving tabindex, disabled propagation, mouse/keyboard interactions.action-group.a11y.spec.ts): ARIA snapshots, keyboard navigation (Tab in/out, arrow keys, Home/End), aXe WCAG validation, and a new ARIA-snapshot assertion for the toolbar-wrapper composition pattern.action-group.vrt.ts,action-group-custom-properties.vrt.ts): size/density/quiet permutations, justified, disabled, focus-ring z-index, static colors, forced-colors, and custom-property overrides.ToolbarCompositionstory, added to back the new toolbar-composition a11y assertion (the ARIA structure it checks has no visual signature, so it's intentionally not covered by VRT).action-button-custom-properties.vrt.ts): action-group's compact-mode corner-radius cascade added four new per-corner custom properties toswc-action-button(--swc-action-button-border-{start-start,start-end,end-start,end-end}-radius), but action-button's own custom-property VRT was never updated to cover them — its coverage assertion was failing. Added reference/override cases for all four; verified each overrides exactly one corner independently.Also updates the migration plan's testing checklist to reflect what's covered here, including a note on why toolbar-wrapper composition is verified via ARIA snapshot rather than VRT.
Motivation and context
swc-action-group's implementation and stories landed onswc-2212/migrate-action-groupwithout dedicated tests. This closes that gap ahead of the documentation pass (swc-2218/action-group-docs) and final migration review. The action-button fix was found while verifying this PR's own VRT coverage against the current custom-elements manifest.Related issue(s)
Screenshots (if appropriate)
N/A — test-only change; visual coverage is captured as Chromatic VRT snapshots.
Author's checklist
swc-2218/action-group-docsbranch.Reviewer's checklist
patch,minor, ormajorfeaturesManual review test cases
Unit/behavior suite passes
yarn testfor the 2nd-genswcpackage.action-group.test.tssuite passes with no skipped assertions.VRT stories render correctly
Permutations,ForcedColors, andCustomPropertiesfor missing rows or unstyled groups.Toolbar composition a11y assertion passes
test-2ndgen-a11y).action-group.a11y.spec.tspasses, including the new toolbar-wrapper-composition ARIA snapshot test.Action-button custom-property coverage fixed
yarn test— confirmaction-button-custom-properties.vrt.tspasses (this assertion was failing before this PR).Device review
Accessibility testing checklist
Keyboard (required — document steps below)
tabindex="0"correctly, and the second Tab leaves the group instead of moving to the next button.Screen reader (required — document steps below)
components-action-group--toolbar-composition).