Created
December 25, 2022 02:08
-
-
Save SatyaAchanta/cd1163ef0f4146450a293df296fda140 to your computer and use it in GitHub Desktop.
pop over test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
test("should display popover message when hovered", async () => { | |
const user = userEvent.setup(); | |
render(<SummaryForm />); | |
//popover should start hidden | |
const noPopoverElement = screen.queryByText( | |
/no ice cream will actually be delivered/i | |
); | |
expect(noPopoverElement).not.toBeInTheDocument(); | |
// popover should display on hover | |
const checkboxElement = screen.getByText(/terms and conditions/i); | |
await user.hover(checkboxElement); | |
const popoverElement = screen.getByText( | |
/no ice cream will actually be delivered/i | |
); | |
expect(popoverElement).toBeInTheDocument(); | |
// popover should be hidden on unhover | |
await user.unhover(checkboxElement); | |
expect(noPopoverElement).not.toBeInTheDocument(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment