New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
document is null during testing #1707
Comments
It might be worth asking about this on the |
@raza-jamil-reckon @benoitgrelard I have also problem with popover & i solved it. i only just wrap Popover/Dropdown by tag div and it worked.
|
Having this same issue, I also asked on floating-ui, but I think this must be on radix-ui:
This must be working because you are never interacting in any way with the popover, but in more complex tests (Where you really interact with it) its exploding. |
Did some debugging here: floating-ui/floating-ui#1908 (comment) In summary:
|
Closing as a solution was provided by @atomiks above ☝️ |
I'm on jest 27.5.0 and am trying to upgrade to node 18 - still getting |
Bug report
Current Behavior
I'm trying to test the clicking of a drop down item. I found out that I have to mock window.PointerEvent which I'm doing per this answer. When I open the menu using the pointer event in my unit test, it throws the following error:
It basically boils down to this function in floating-ui: https://github.com/floating-ui/floating-ui/blob/master/packages/dom/src/utils/getDocumentElement.ts where document seems to be null. If I make it chain optionally on my local it starts working fine.
I can confirm that window.document is not null inside my test.
Expected behavior
The menu should open.
Reproducible example
Suggested solution
I'm not sure if it's a radix issue or popper or floating-ui issue or my setup issue. Any help would be appreciated.
Additional context
Your environment
The text was updated successfully, but these errors were encountered: