Using `useFloating` with jest and testing-library
See original GitHub issueSorry for not using the sandboxes provided, but this is a problem that happens on the node
environment, so I created a stackblitz
https://stackblitz.com/edit/node-75er2t?file=index.jsx
You can see that when rendering the <Floating />
component (code taken from docsite), there is immediately an error that states that something was not called in act
. I think that this might be a consequence of computePosition
being asynchronous.
It could be that I’m missing some kind of knowledge how to use floating-ui correctly in tests, but I keep getting this error even when try to use the least amount of code.
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Setup - Testing Library
In these docs we'll demonstrate configuring Jest, but you should be able to do similar things with any testing framework (React Testing ...
Read more >@floating-ui/react-dom-interactions - npm
Start using @floating-ui/react-dom-interactions in your project by running `npm i ... @testing-library/jest-dom · @testing-library/react ...
Read more >React - Floating UI
A JavaScript library for anchor positioning with web, React, and Vue bindings, plus interaction primitives for React to build floating UI components.
Read more >Testing React Apps - Jest
At Facebook, we use Jest to test React applications. ... The following two examples use react-testing-library and Enzyme.
Read more >How To Test a React App with Jest and React Testing Library
Obtaining solid test coverage is imperative for building confidence in your web application. In this tutorial, you will test asynchronous ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Docs explain: https://floating-ui.com/docs/react-dom#testing (I made an issue about this on testing-lib repo, but it doesn’t seem like they’ll change the timing of the cleanup function)
I forgot to respond somehow, yes a new issue with a minimal repro of the problem would be good