bvaughn / react-resizable-panels

https://react-resizable-panels.vercel.app/
MIT License
3.99k stars 144 forks source link

Panels messes with click events in react-testing-library tests using JSDOM. #398

Closed karl-run closed 2 months ago

karl-run commented 2 months ago

I just discovered this, so I haven't made a minimal repro yet.

But I had this simple home-made two pane view that I could 1:1 replace with two Panel in a PanelGroup (diff) which was super nice!

But I have a couple of RTL+JSDOM tests that started failing on non-obvious stuff, like clicking a button using userEvent would be fine, it would find the button and click it, and whatever what supposed to happen after the button click didn't happen. Like the event didn't fire at all.

For example this test (big uggo test pls don't judge :sweat:) would fail on line 53:

https://github.com/navikt/syk-dig/blob/main/src/components/nasjonal-oppgave/__tests__/submitOppgave.test.tsx#L52-L53

If I straight up replace all the Panel and PanelGroup with div the tests run again.

bvaughn commented 2 months ago

Seems like a duplicate of #367. Check out this comment about styling: https://github.com/bvaughn/react-resizable-panels/issues/367#issuecomment-2241908486

bvaughn commented 2 months ago

This seems most likely to be a duplicate so I'm going to close it for now.