Real-world a11y expectation. Exercises userEvent.tab() together with the existing be.focused assertion.
Scope
- New test file
examples/twd-test-app/src/twd-tests/contact-keyboard.twd.test.ts:
- Visit
/contact.
- Query every field with
screenDom.getByLabelText(...).
- Call
userEvent.tab() repeatedly; after each Tab, assert the expected field with twd.should(el, "be.focused").
- Confirm
Shift+Tab reverses the focus order.
- Confirm that pressing Enter on the last field submits the form (or moves focus to the submit button).
- If the Contact page is missing proper labels for
getByLabelText, add them — avoid relying on CSS selectors.
Reference
examples/twd-test-app/src/twd-tests/screen-queries.twd.test.ts for screenDom usage.
examples/twd-test-app/src/twd-tests/assertion-examples.twd.test.ts for be.focused.
Acceptance criteria
How to contribute
Read CONTRIBUTING.md first. Quick steps for this issue:
- Fork, clone, create a feature branch:
git checkout -b feat/contact-keyboard-test.
- From the repo root, build the library and sync it to the example apps:
npm install
npm run build
npm run copy:mock-sw
- Install and run the test app:
cd examples/twd-test-app
npm install
npm run dev
- Open the app in the browser — the TWD sidebar appears on the right. Run your new tests from the sidebar and confirm they pass.
- Run the library's unit tests from the repo root:
npm run test:ci.
- Open the PR with screenshots of the sidebar showing green tests.
Always prefer screenDom (Testing Library) for element queries. Avoid twd.get() in new code.
Real-world a11y expectation. Exercises
userEvent.tab()together with the existingbe.focusedassertion.Scope
examples/twd-test-app/src/twd-tests/contact-keyboard.twd.test.ts:/contact.screenDom.getByLabelText(...).userEvent.tab()repeatedly; after each Tab, assert the expected field withtwd.should(el, "be.focused").Shift+Tabreverses the focus order.getByLabelText, add them — avoid relying on CSS selectors.Reference
examples/twd-test-app/src/twd-tests/screen-queries.twd.test.tsforscreenDomusage.examples/twd-test-app/src/twd-tests/assertion-examples.twd.test.tsforbe.focused.Acceptance criteria
docs/writing-tests.md.How to contribute
Read CONTRIBUTING.md first. Quick steps for this issue:
git checkout -b feat/contact-keyboard-test.cd examples/twd-test-app npm install npm run devnpm run test:ci.