Skip to content

userEvent.hover doesn't work: The provided value is not of type 'Element' (v14.2.1) #979

Answered by ph-fritsche
epodgaetskiy asked this question in Q&A
Discussion options

You must be logged in to vote

This is a problem with shadowed globals in the test environment. See #892
You need to setup user-event with the document that is also used by render, otherwise it falls back to globalThis.document which is a different one:

const user = userEvent.setup({document})

Testing pseudo-classes like this is, unfortunately, impossible because they can not be controlled programmatically.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by ph-fritsche
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants