Popper internally calls forceUpdate which leads to a re-render outside of React's normal lifecycle. This causes testing-library to rightfully throw act warnings in various test suites.
After digging into this, the common recommendation is to mock popper in tests.
NOTE: The Tooltip test suite has certain expectations around popper behaviour so I did not mock it there.
Changes
Fixed
Mock popper in various test suites
Modernized test suites with userEvent and screen queries
Before / After
Before this change, when running this Combobox test case, there is an act warning in the console. After, there are no act warnings.
Testing
Run the combobox test suite and observe zero act warnings in the console.
Disable the mock at the top of that suite and you'll see 1 act warning.
Feel free to verify the other suites I updated all contain zero act warnings.
Motivations
Popper internally calls
forceUpdate
which leads to a re-render outside of React's normal lifecycle. This causes testing-library to rightfully throw act warnings in various test suites.After digging into this, the common recommendation is to mock popper in tests.
NOTE: The
Tooltip
test suite has certain expectations around popper behaviour so I did not mock it there.Changes
Fixed
Before / After
Before this change, when running this Combobox test case, there is an act warning in the console. After, there are no act warnings.
Testing
Feel free to verify the other suites I updated all contain zero act warnings.
Changes can be tested via Pre-release