Skip to content
React Spring Bottom Sheet
PrimitivesNIPE Open Source
Browse documentation
On this page

docs / testing

Testing

Assert user-visible sheet behavior without binding tests to animation internals.

Query the interface by role

Open the sheet through its trigger and query the resulting dialog by its accessible name. This verifies the same semantic boundary assistive technology receives and survives internal DOM changes.

await user.click(screen.getByRole('button', { name: /open/i }))
expect(screen.getByRole('dialog', { name: /filters/i })).toBeVisible()

Observe state instead of sleeping

Wait for the dialog to appear or be removed rather than adding fixed delays. For deterministic component tests, enable reduced motion; keep a smaller browser suite with real motion to protect opening, closing, drag, and focus-restoration behavior.

Cover the workflow boundaries

Test trigger, explicit close, Escape, backdrop, and drag only when your product enables them. Controlled integrations should also prove the callback updates application state and that focus returns after close.