-
-
Notifications
You must be signed in to change notification settings - Fork 13
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
Should be wrapped in act(...) #60
Comments
Hi @razzeee, please provide a minimal reproducible example (like github repo, codesandbox, stackblitz...), it is recommended to fork the Headless UI Flaot's Online Demo to reproduce. |
FYI, we currently have to add it('renders positive', async () => {
render(<HoursPillRelative hours={-9} />)
await waitFor(() => expect(screen.getByText('+9h')).toBeInTheDocument())
}) That's our workaround for now. If it can be done in the library, it would spare quiet some work. I'll look into creating a repro asap. |
I found it quiet hard to work it into the online demo, as there is no testing integrated at all. Creating a new redwoodjs app might just be easier for me. |
Yes, I think may not need to use the online demo. I just need a minimal reproducible example. I can only do my best to help you with the However, I can give you a reference code: Headless UI Float's unit test. I also encountered this problem many times when writing unit tests, but I still couldn't understand why this error occurred. This test is driven by Vitest. I hope it can help you build a minimal example and solve this problem. |
I found that this issue can only be solved by using headlessui-float/packages/react/test/unit/components.test.tsx Lines 6 to 38 in d2d19f1
However, I created a util function based on the usage of Floating UI, which can help your code look more concise:
I hope this can help you. However, I think this issue cannot be solved in the package, so I will close this issue for now. If you have a better solution, please send a PR. |
Use Version
Use version when bugs appear:
@floating-ui/core
: v1.2.6@floating-ui/dom
: v1.2.7Describe the bug
Running tests with the file under test using this component causes:
There is also an issue over at testing-library/testing-library-docs#1255
It seemed to only show up after the react 18 update, but I'm unsure. Maybe it's even expected, that we need to do that, as the docs don't have any test examples :)
The text was updated successfully, but these errors were encountered: