Skip to content

Add tests for the TextField component label, error, and aria wiring #18

@mikewheeleer

Description

@mikewheeleer

Test the TextField label association and aria-invalid/describedby wiring

Description

src/components/TextField.tsx is the accessible input primitive (auto-generated id via useId, aria-describedby linking description and error, aria-invalid and role="alert" on errors) intended for forms across the app, but it has no test. This issue verifies its accessibility contract so future form refactors can rely on it.

Requirements and context

  • Repository scope: Agentpay-Org/Agentpay-frontend only.
  • Assert: the label is associated with the input (clicking the label focuses the input), description renders with an id referenced by aria-describedby, and an error sets aria-invalid and renders role="alert" referenced by aria-describedby.
  • Assert a caller-supplied id overrides the generated one.
  • Verify no aria-describedby attribute is emitted when neither description nor error is present.

Suggested execution

  • Fork the repo and create a branch
  • git checkout -b test/testing-19-textfield
  • Implement changes
    • Write comprehensive tests in: create src/components/__tests__/TextField.test.tsx.
    • Add documentation: add a short JSDoc usage note to src/components/TextField.tsx.
    • Validate with @testing-library/jest-dom matchers.
  • Test and commit

Test and commit

  • Run npm run lint, npm run typecheck, and npm test.
  • Cover edge cases: description + error together, error-only, and custom id.
  • Include the npm test output and coverage for the component.

Example commit message

test(components): cover TextField label and aria wiring

Guidelines

  • Minimum 95 percent test coverage for TextField.tsx.
  • Clear, reviewer-focused documentation.
  • Timeframe: 96 hours.

Community & contribution rewards

  • 💬 Join the AgentPay community on Discord for questions, reviews, and faster merges: https://discord.gg/eXvRKkgcv
  • ⭐ This is a GrantFox OSS / Official Campaign task and may be rewarded. When your PR is merged you'll be prompted to rate the project — if this issue and the maintainers helped you ship, we'd be grateful for a 5-star rating. Clear questions in Discord and tidy, well-tested PRs are the fastest path to a merge and a reward.

Metadata

Metadata

Assignees

No fields configured for Feature.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions