Skip to content

test(action-group): add unit, accessibility, and VRT coverage - #6589

Open
rise-erpelding wants to merge 9 commits into
swc-2212/migrate-action-groupfrom
swc-2217/action-group-tests
Open

test(action-group): add unit, accessibility, and VRT coverage#6589
rise-erpelding wants to merge 9 commits into
swc-2212/migrate-action-groupfrom
swc-2217/action-group-tests

Conversation

@rise-erpelding

@rise-erpelding rise-erpelding commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

Description

Adds Phase 6 test coverage for the 2nd-gen swc-action-group migration:

  • Unit/behavior tests (action-group.test.ts): defaults, ARIA attributes, roving tabindex, disabled propagation, mouse/keyboard interactions.
  • Accessibility tests (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.
  • VRT coverage (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.
  • A small ToolbarComposition story, 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 VRT fix (action-button-custom-properties.vrt.ts): action-group's compact-mode corner-radius cascade added four new per-corner custom properties to swc-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 on swc-2212/migrate-action-group without 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)

  • fixes SWC-2217
  • part of Epic SWC-2212

Screenshots (if appropriate)

N/A — test-only change; visual coverage is captured as Chromatic VRT snapshots.


Author's checklist

  • I have read the CONTRIBUTING and PULL_REQUESTS documents.
  • I have reviewed at the Accessibility Practices for this feature, see: Aria Practices
  • I have added automated tests to cover my changes.
  • I have included a well-written changeset if my change needs to be published. — N/A, test-only; nothing publishable changes.
  • I have included updated documentation if my change required it. — N/A, Storybook/MDX docs are covered by the separate swc-2218/action-group-docs branch.

Reviewer's checklist

  • Includes a Github Issue with appropriate flag or Jira ticket number without a link
  • Includes thoughtfully written changeset if changes suggested include patch, minor, or major features
  • Automated tests cover all use cases and follow best practices for writing
  • Validated on all supported browsers
  • All VRTs are approved before the author can update Golden Hash

Manual review test cases

  • Unit/behavior suite passes

    1. Run yarn test for the 2nd-gen swc package.
    2. Confirm the action-group.test.ts suite passes with no skipped assertions.
  • VRT stories render correctly

    1. Run Storybook locally and open Action Group / Action Group VRT.
    2. Check Permutations, ForcedColors, and CustomProperties for missing rows or unstyled groups.
    3. Confirm Chromatic snapshots for this PR match expectations before accepting baselines.
  • Toolbar composition a11y assertion passes

    1. Run the 2nd-gen Playwright a11y suite (test-2ndgen-a11y).
    2. Confirm action-group.a11y.spec.ts passes, including the new toolbar-wrapper-composition ARIA snapshot test.
  • Action-button custom-property coverage fixed

    1. Run Storybook locally and open Action Button / Action Button VRT → CustomProperties.
    2. Confirm four new rows exist for the per-corner border-radius properties, each showing exactly one corner rounded differently from its reference.
    3. Run yarn test — confirm action-button-custom-properties.vrt.ts passes (this assertion was failing before this PR).

Device review

  • Did it pass in Desktop?
  • Did it pass in (emulated) Mobile?
  • Did it pass in (emulated) iPad?

Accessibility testing checklist

  • Keyboard (required — document steps below)

    1. In Storybook, open Action Group / Docs → Overview.
    2. Press Tab to enter the group (one stop), then ArrowRight / ArrowLeft to move among action-buttons; press Tab again.
    3. Expect exactly one visible focus ring at a time, arrow keys move roving tabindex="0" correctly, and the second Tab leaves the group instead of moving to the next button.
  • Screen reader (required — document steps below)

    1. With a screen reader active, navigate to the toolbar-wrapper-composition example (components-action-group--toolbar-composition).
    2. Move focus through the outer wrapper and into each named group and its buttons.
    3. Expect the outer landmark announced as "toolbar, Document actions", each inner cluster announced as "group, Edit actions" / "group, View actions", and each button announced with its label and role.

@rise-erpelding rise-erpelding added the gen2 These issues or PRs map to our 2nd generation work to modernizing infrastructure. label Aug 6, 2026
@changeset-bot

changeset-bot Bot commented Aug 6, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 5b8862a

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@rise-erpelding
rise-erpelding force-pushed the swc-2217/action-group-tests branch from 0cc1e2c to 613bade Compare August 6, 2026 18:53

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Compact action groups need to be able to modify the action button corner radii, this adds VRT testing for those

Comment on lines +219 to +225
const staticColorsContent = () =>
ACTION_GROUP_STATIC_COLORS.map((staticColor) =>
staticColorBackground(
row([renderGroup({ staticColor })], `Static ${staticColor}`),
staticColor
)
);

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree to take out - if it's not implemented/managed by this component directly, then it can be removed (or added to the other, if needed).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

^ maybe a note to add to the skill to improve it/prevent this redundancy?

@rise-erpelding
rise-erpelding force-pushed the swc-2217/action-group-tests branch from 9a284f0 to 0737283 Compare August 6, 2026 22:00
@rise-erpelding
rise-erpelding marked this pull request as ready for review August 6, 2026 22:01
@rise-erpelding
rise-erpelding requested a review from a team as a code owner August 6, 2026 22:01

@cdransf cdransf left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One small question! Looks great! ✨

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

📚 Branch Preview Links

🔍 Gen1 Visual Regression Test Results

When 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: pr-6589

If the changes are expected, update the current_golden_images_cache hash in the circleci config to accept the new images. Instructions are included in that file.
If the changes are unexpected, you can investigate the cause of the differences and update the code accordingly.

@coveralls

coveralls commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

Coverage Report for CI Build 31215990171

Warning

No base build found for commit ee17f35 on swc-2212/migrate-action-group.
Coverage changes can't be calculated without a base build.
If a base build is processing, this comment will update automatically when it completes.

Coverage: 96.249%

Details

  • Patch coverage: No coverable lines changed in this PR.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

Requires a base build to compare against. How to fix this →


Coverage Stats

Coverage Status
Relevant Lines: 39351
Covered Lines: 38076
Line Coverage: 96.76%
Relevant Branches: 6471
Covered Branches: 6027
Branch Coverage: 93.14%
Branches in Coverage %: Yes
Coverage Strength: 459.35 hits per line

💛 - Coveralls

@rise-erpelding
rise-erpelding force-pushed the swc-2217/action-group-tests branch from 70685fe to 5dcf4a4 Compare August 7, 2026 16:14
@5t3ph 5t3ph added the run_vrt Triggers the Chromatic VRT run for 2nd-gen label Aug 7, 2026

@5t3ph 5t3ph left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good, just a couple small suggestions!

* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think of adding tests for one, two, and four buttons just to make sure the corner rounding comes through as expected? Can be one size for all.

render: () => html`
<div
role="toolbar"
aria-label="Document actions"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use of aria-orientation becomes important when role="toolbar" is applied. Maybe a note that when you do the a11y docs that you include a vertical example to show applying aria-orientation="vertical" since the default for toolbar is horizontal?

@5t3ph 5t3ph self-assigned this Aug 7, 2026
Comment on lines +62 to +69
/* @global-exclude: fills a shadow-DOM host stretched by an ancestor flex layout (e.g. vertical swc-action-group); plain elements via global classes already stretch natively */
/* stylelint-disable-next-line no-duplicate-selectors -- re-opens .swc-ActionButton so the @global-exclude fence (see vite-global-elements-css) can strip just this declaration from the generated global stylesheet without excluding the rest of the class's rules */
.swc-ActionButton {
inline-size: 100%;
}

/* @global-exclude-end */

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@5t3ph I started looking at Chromatic and realized that while <swc-action-button> isn't affected by applying inline-size: 100% (for vertical action group alignment), the global action button is. I'm excluding this style, and I committed the changes to the global stylesheet. I'm not 100% that's how this is supposed to be handled though so would appreciate some eyes on this piece.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Component:Action group gen2 These issues or PRs map to our 2nd generation work to modernizing infrastructure. run_vrt Triggers the Chromatic VRT run for 2nd-gen Status:Ready for review PR ready for review or re-review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants