Solution: Test a Complex Form Workflow
Tests verify user-visible behavior only. A parent-owned draft preserves input across steps, validation blocks progress with accessible field-linked alerts, and submission is transactional with `useActionState`, `useOptimistic`, and `useTransition` to show an immediate pending receipt and keep the UI responsive.
We'll cover the following...
Here’s the implementation for the complex form workflow with an explicit wizard owner that centralizes draft, step, and error state so every step transition is a pure view change, not a data reset. Validation is treated as part of the commit cycle: when the user attempts to advance with invalid fields, errors render next to inputs, each input is marked with aria-invalid, each message is referenced by aria-describedby ...