Skip to content

✅ test: add tests for PhoneNumberInput, Input and Command - #673

Merged
futjesus merged 1 commit into
mainfrom
test/component-backlog
Jul 27, 2026
Merged

✅ test: add tests for PhoneNumberInput, Input and Command#673
futjesus merged 1 commit into
mainfrom
test/component-backlog

Conversation

@futjesus

Copy link
Copy Markdown
Member

Summary

Fourth PR of the audit series (stacked on #672). Adds behavior tests for the three riskiest components that shipped with zero coverage.

Changes

  • PhoneNumberInput (652 LOC, previously untested): default prefix rendering, country selection through the flag selector (search + pick, prefix updates), typing fires onChange, Escape and outside-click close the selector, axe check. The country list is virtualized (TanStack Virtual), so the tests mock offsetHeight/offsetWidth for jsdom.
  • Two real a11y bugs surfaced by the axe test, fixed here: the flag selector <button> had no accessible name (now aria-label="Select country, <name>" + aria-expanded), and the <label> used id={id} instead of htmlFor={id} so it never associated with the input (and duplicated the input's id).
  • Input: label association via useId, required marker, onChange, error state + data-error, error/helper-text precedence, password visibility toggle, axe.
  • Command: palette open, cmdk filtering, keyboard selection, Escape close (composed with CommandProvider/CommandInput/CommandList as the stories do), axe.

Testing

18 new tests, full suite green (lint, types, prettier, coverage thresholds).

@futjesus
futjesus force-pushed the fix/a11y-focus-and-roles branch 2 times, most recently from 605bd9a to 1ba36c2 Compare July 27, 2026 15:03
Base automatically changed from fix/a11y-focus-and-roles to main July 27, 2026 15:07
- PhoneNumberInput: country selection, prefix updates, typing, Escape and
  outside-click close, axe (6 tests)
- Fix two a11y bugs the axe test surfaced: the flag selector button had no
  accessible name, and the label used id instead of htmlFor so it never
  associated with the input
- Input: label association, required marker, onChange, error/helper
  precedence, password visibility toggle, axe (7 tests)
- Command: open/filter/keyboard-select/Escape via CommandProvider, axe
  (5 tests)
@futjesus
futjesus force-pushed the test/component-backlog branch from 4a34ea6 to 3b3120a Compare July 27, 2026 15:09
@futjesus
futjesus merged commit 3b90440 into main Jul 27, 2026
2 checks passed
@futjesus
futjesus deleted the test/component-backlog branch July 27, 2026 15:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant