Closed
Description
@testing-library/dom
version: 7.10.1- Testing Framework and version:
jest
@26.0.1 via@testing-library/react
@10.2.1 - DOM Environment: Jest defaults
Relevant code or config
fireEvent.click(new Promise(jest.fn());
What you did:
This is a contrived example; what I actually did was pass the result of findByRole
instead of getByRole
.
What happened:
Unable to find the "window" object for the given node. Please file an issue with the code that's causing you to see this error: https://github.com/testing-library/dom-testing-library/issues/new
40 | await act(async () => {
> 41 | fireEvent.click(jest.fn());
| ^
42 | });
Problem description:
getWindowFromNode
doesn't account for the node
not being a Node
.
Suggested solution:
Give an explicit error message if it's an instance of a Promise
.