Skip to content

test(ComplexSelector): cover trigger value and placeholder as content - #8499

Merged
cixzhang merged 2 commits into
meta:mainfrom
parinith-web:test/complexselector-label-in-name
Oct 31, 2026
Merged

cixzhang merged 2 commits into
meta:mainfrom
parinith-web:test/complexselector-label-in-name

Conversation

@parinith-web

@parinith-web parinith-web commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Refs #7965

Maintainer impact

#7965 reported that the ComplexSelector trigger was a button named by aria-labelledby while showing the chosen value, so the value was not exposed (WCAG 2.5.3, axe label-content-name-mismatch). The trigger is now role="combobox" (see the "ComplexSelector: the trigger is now a combobox" changeset). Existing tests already find the trigger as a combobox by its label, but nothing asserts that the chosen value or the placeholder is the trigger's content, so a regression that stopped rendering it would pass the suite.

Intended invariant

The built-in trigger is a combobox named by the field label, and the chosen value (or the placeholder) is its content, as with Selector.

Change

Two unit tests in ComplexSelector.test.tsx, next to the existing "trigger semantics" tests. No source change. They assert that:

  • a trigger showing triggerLabel="Acme Ltd" is a combobox with the accessible name "Supplier", has "Acme Ltd" as its text content, and is not exposed as a button;
  • the same holds when the trigger shows the placeholder.

This belongs in maintenance because it adds regression coverage for behavior that already shipped.

Evidence

  • Failure before the change: with the built-in trigger no longer rendering triggerContent (the value or placeholder text), only the 2 new tests fail (2 failed, 58 passed of 60). No existing test catches this.
  • Note on the role: removing role="combobox" fails 40 of the 60 ComplexSelector tests, because existing tests already look the trigger up as a combobox by its label. The new tests are among those failures, but that is not what they add.
  • Success after the change: ComplexSelector.test.tsx, ComplexSelector.fr10.test.tsx and ComplexSelector.focusableDisabled.test.tsx pass (60/60, after merging main).
  • Product/runtime behavior verified unchanged: no source files touched; the diff is one test file, +37 lines.

Scope

  • No intended public API, product behavior, visual direction, or policy change.
  • Product changes discovered during the work were removed or split.
  • Public text and artifacts contain no internal Meta context.

Testing

  • pnpm vitest run --project ui packages/core/src/ComplexSelector/
  • pnpm exec prettier --check and pnpm exec eslint on the changed file
  • Failure injection: emptied the trigger's text span (so triggerContent is not rendered) and confirmed only the 2 new tests fail (2 failed, 58 passed of 60); separately removed role="combobox" and confirmed 40/60 fail. Restored the file after each.
  • I did not add an axe assertion. The repo's axe checks run in Playwright, and the pinned @axe-core/playwright (4.12.x) predates label-content-name-mismatch moving to wcag21a.

- by parinith-web

@vercel

vercel Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
astryx Ready Ready Preview Oct 27, 2026 10:01am UTC

Request Review

@astracat-bot

astracat-bot Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Oct 27, 2026, 10:20 AM UTC

@github-actions github-actions Bot added community Authored by a community contributor (not on the eng/design team) needs:code-review High-risk change (new package/component/API) — needs human code review before merge labels Oct 26, 2026

@astracat-bot astracat-bot Bot 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.

The two new tests are sound: they pass, and each is the only ComplexSelector test that fails when the built-in trigger stops rendering the chosen triggerLabel or a caller placeholder. Please correct the description before merge: removing role="combobox" from the built-in trigger fails 37 of the 57 ComplexSelector tests, not 3, because existing tests such as ComplexSelector.test.tsx:155 and :344 already find the trigger as a combobox by its exact label, so what these tests add is value-as-content and placeholder-as-content coverage.

[Automated review]

@parinith-web parinith-web changed the title test(ComplexSelector): cover label-as-name and value-as-content on the trigger test(ComplexSelector): cover trigger value and placeholder as content Oct 26, 2026
@parinith-web

Copy link
Copy Markdown
Contributor Author

The two new tests are sound: they pass, and each is the only ComplexSelector test that fails when the built-in trigger stops rendering the chosen triggerLabel or a caller placeholder. Please correct the description before merge: removing role="combobox" from the built-in trigger fails 37 of the 57 ComplexSelector tests, not 3, because existing tests such as ComplexSelector.test.tsx:155 and :344 already find the trigger as a combobox by its exact label, so what these tests add is value-as-content and placeholder-as-content coverage.

[Automated review]

Thanks for the review. You're right: my earlier "3 tests fail" came from a run filtered to the "trigger semantics" block. I've corrected the description:

  • Removing role="combobox" fails 37 of the 57 ComplexSelector tests.
  • With the trigger no longer rendering triggerContent, only the 2 new tests fail (2 failed, 55 passed), so the value-as-content and placeholder-as-content coverage is what the PR adds.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Oct 26, 2026
…r-label-in-name

# Conflicts:
#	packages/core/src/ComplexSelector/ComplexSelector.test.tsx
@parinith-web

Copy link
Copy Markdown
Contributor Author

Merged main to resolve a conflict in ComplexSelector.test.tsx (the new FR10 name tests landed next to mine). Kept both sets of tests; the file still adds only the two value/placeholder-as-content tests. ComplexSelector suite passes locally (60/60).

@astracat-bot astracat-bot Bot 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.

The two new tests are sound: they pass, and each is the only ComplexSelector test that fails when the built-in trigger stops showing the chosen triggerLabel or a caller placeholder, so no code changes are needed. One optional fix: the description's counts predate merging main, which added three ComplexSelector tests, so on the current branch the suites hold 60 tests, emptying the trigger text fails 2 and passes 58, and removing role="combobox" fails 40 of 60.

[Automated review]

@cixzhang cixzhang added the ci:run A maintainer lets this outside contributor's pull request run CI (AST-030 FR17) label Oct 31, 2026
@cixzhang cixzhang closed this Oct 31, 2026
@cixzhang cixzhang reopened this Oct 31, 2026
@github-actions github-actions Bot removed the needs:code-review High-risk change (new package/component/API) — needs human code review before merge label Oct 31, 2026
@github-actions

github-actions Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

📚 Storybook Preview

View Storybook for this PR

🧪 Sandbox Preview

View Sandbox for this PR

Modified Components

ComplexSelector (@astryxdesign/core) · View in Storybook
Metric Before After Delta
Entry File (ESM) 258B 258B 0B
Lines of Code 646 646 -
Complexity Very High Very High (73) -

Component Size

Component Import before Import after Delta CSS before CSS after Delta
core/ComplexSelector 55.8KB 55.8KB 0B 10.6KB 10.6KB 0B

Sizes are gzip. Import counts the JavaScript the import loads eagerly; CSS counts the package stylesheet rules referenced by the modules it can load from its own package, lazily loaded ones included.

Bundle Size Summary

Gzip figures measure each package's entry file, not the code an import pulls in.

Package Entry (ESM) Entry gzip before Entry gzip after Delta
@astryxdesign/core 4.9KB 1.2KB 1.2KB 0B
Package stylesheet Gzip before Gzip after Delta
@astryxdesign/core 34.6KB 34.6KB 0B

Accessibility Audit

Status: The accessibility audit did not run on this pull request. It runs after merges to main and before each release; pull requests that touch components run it with the ci:heavy-lanes label.


Generated by PR Enrichment workflow | Storybook | Sandbox | View full report

@cixzhang
cixzhang merged commit 7a76092 into meta:main Oct 31, 2026
59 of 60 checks passed

This branch was successfully deployed

1 active deployment
Preview — fa908729 Deployed Oct 27, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:run A maintainer lets this outside contributor's pull request run CI (AST-030 FR17) CLA Signed This label is managed by the Meta Open Source bot. community Authored by a community contributor (not on the eng/design team)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants