Repository navigation
test(ComplexSelector): cover trigger value and placeholder as content - #8499
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
There was a problem hiding this comment.
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:
|
…r-label-in-name # Conflicts: # packages/core/src/ComplexSelector/ComplexSelector.test.tsx
|
Merged |
There was a problem hiding this comment.
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]
PR Analysis Report📚 Storybook Preview🧪 Sandbox PreviewModified ComponentsComplexSelector (@astryxdesign/core) · View in Storybook
Component Size
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 SummaryGzip figures measure each package's entry file, not the code an import pulls in.
Accessibility AuditStatus: The accessibility audit did not run on this pull request. It runs after merges to Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
Refs #7965
Maintainer impact
#7965 reported that the ComplexSelector trigger was a button named by
aria-labelledbywhile showing the chosen value, so the value was not exposed (WCAG 2.5.3, axelabel-content-name-mismatch). The trigger is nowrole="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:triggerLabel="Acme Ltd"is acomboboxwith the accessible name "Supplier", has "Acme Ltd" as its text content, and is not exposed as abutton;This belongs in maintenance because it adds regression coverage for behavior that already shipped.
Evidence
triggerContent(the value or placeholder text), only the 2 new tests fail (2 failed, 58 passed of 60). No existing test catches this.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.ComplexSelector.test.tsx,ComplexSelector.fr10.test.tsxandComplexSelector.focusableDisabled.test.tsxpass (60/60, after mergingmain).Scope
Testing
pnpm vitest run --project ui packages/core/src/ComplexSelector/pnpm exec prettier --checkandpnpm exec eslinton the changed filetriggerContentis not rendered) and confirmed only the 2 new tests fail (2 failed, 58 passed of 60); separately removedrole="combobox"and confirmed 40/60 fail. Restored the file after each.@axe-core/playwright(4.12.x) predateslabel-content-name-mismatchmoving towcag21a.- by parinith-web