Skip to content

test(forms): cover states and interactions - #719

Open
Fabluchy wants to merge 1 commit into
StableRoute-Org:mainfrom
Fabluchy:test/forms-01-component
Open

test(forms): cover states and interactions#719
Fabluchy wants to merge 1 commit into
StableRoute-Org:mainfrom
Fabluchy:test/forms-01-component

Conversation

@Fabluchy

Copy link
Copy Markdown
Contributor

Summary

Add comprehensive React Testing Library tests for the TextField and Button form components covering loading, empty, error, success, disabled, busy, and keyboard interaction states. Asserts accessible names and roles.

Closes #561

Changes

TextField (previously 1 test → now 35 tests)

  • Error states: role=alert, aria-invalid, aria-describedby, error clearing/replacement
  • Loading/busy states: aria-busy forwarding, disabled+aria-busy combined
  • Empty state: no value displayed, no aria-invalid when clean
  • Disabled state: disabled attribute, disabled blocks value changes
  • Keyboard interaction: value changes via fireEvent.change, controlled/uncontrolled values
  • Accessibility: label htmlFor association, focus-visible outline, no hardcoded colors
  • HTML attribute forwarding: name, type, required, maxLength, inputMode, className
  • Success state: aria-invalid removed when error cleared

Button (previously 8 tests → now 29 tests)

  • Disabled state: disabled attr, disabled styling, click prevention, all variants
  • Loading/busy states: aria-busy forwarding, disabled+aria-busy combined, accessible name preserved
  • Click handling: single click, multi-click, disabled click prevention
  • Variants: primary, secondary, danger with correct class assertions
  • Type attribute: button, reset forwarding
  • HTML attribute forwarding: name, value, className merging
  • Existing asChild and focus ring tests preserved

Test Output

```
Test Suites: 2 passed, 2 total
Tests: 64 passed, 64 total
Snapshots: 0 total
Time: ~1.4s
```

Checklist

  • `npm run lint` passes
  • `npm test` — 64/64 tests pass
  • `npm run build` passes
  • No behavior changes — tests only

@Fabluchy
Fabluchy force-pushed the test/forms-01-component branch 2 times, most recently from faaf634 to 359b3a7 Compare July 30, 2026 21:04
Add comprehensive React Testing Library tests for TextField and Button
form components covering loading, empty, error, success, disabled, busy,
and keyboard interaction states. Asserts accessible names and roles.

Closes StableRoute-Org#561
@Fabluchy
Fabluchy force-pushed the test/forms-01-component branch from 359b3a7 to 69d9fbb Compare July 30, 2026 21:14
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.

Add tests for the forms component states and interactions

1 participant