Skip to content

How to write interaction test for the modal/overlay/dialog? #21971

Answered by scottrippey
seito2 asked this question in Help
Discussion options

You must be logged in to vote

The best way to handle this is to make sure your modal has an accessible role="dialog" and then use screen like this:

import { within, screen } from '@storybook/testing-library';
...
const canvas = within(screen.getByRole('dialog'));

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@fehaa
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by seito2
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
4 participants