V5 mirgation question - Modal TrapFocus component causing issues with Jest 29 #5907
Replies: 6 comments 1 reply
-
I wonder if @thatblindgeye and @wise-king-sullyman have any insight |
Beta Was this translation helpful? Give feedback.
-
Hey @LauraStordeur , do you have a link or code snippet of some examples of unit tests that are failing? Based on the syntax error that you pasted, my first thought is that maybe it's a typo, |
Beta Was this translation helpful? Give feedback.
-
Hey @thatblindgeye ! Thanks for the reply, we are simply consuming the modal and testing if it shows up with some text/ or some content. test-file The tests would fail at the |
Beta Was this translation helpful? Give feedback.
-
Thanks for the links @LauraStordeur ! Looks like the first one (the test-file) is the same as the "file with modal implementation". Can you confirm the link URLs? EDIT: one suggestion that was brought up was updating the version of |
Beta Was this translation helpful? Give feedback.
-
Hey @thatblindgeye I updated the links, my bad. You have the file where the modal is being implemented, and then the test file. Updating |
Beta Was this translation helpful? Give feedback.
-
@LauraStordeur We tried looking into this a bit further. Based on some of the links below, it seems like there's still an issue with tabbable and nwsapi. We believe the best practice would be to mock out dependencies if able. If you'd like to investigate a bit further, here are some of the links we came across: focus-trap/tabbable#982 |
Beta Was this translation helpful? Give feedback.
-
Hi !
We are currently in the process of upgrading to the new version. So far it was going smoothly, thanks for the mods, they work amazingly.
Whenever the modal component is being used in our unit tests, the tests will fail on the inert attribute selector not being valid.
We are using Jest/React-Testing library.
I suspect it relates to focus-trap/tabbable#926
JSDOM looks like it does not support
:not([inert] *)
(but does support:not([inert]
).If I add the
disableFocusTrap
on the modal, the error will be gone. (This isn't the ideal solution, but it's a temporary workaround)This is the error stacktrace:
Is this something I'd rather make a ticket for? Or is this a known issue that will be tackled upon updating the dependencies?
Beta Was this translation helpful? Give feedback.
All reactions