react-modal icon indicating copy to clipboard operation
react-modal copied to clipboard

onAfterOpen is not called in jest tests

Open eszthoff opened this issue 4 years ago • 1 comments

Summary:

During unit testing in Jest/Enzyme onAfterOpen callback is not called; after-open classes are not added to the test snapshots. They seem to work as expected in the UI.

Steps to reproduce:

See test in example code: https://codesandbox.io/s/pedantic-brattain-v2mw8?file=/src/App.spec.js

Expected behavior:

Modal fully opens in test environment as well as in the browser

Link to example of issue:

https://codesandbox.io/s/pedantic-brattain-v2mw8?file=/src/App.spec.js

Additional notes:

This behaviour has started after upgrading to version 3.14. Our tests stated to fail then, with snapshots missing after-open-class-name, and not calling the callback functions. Could not find anything related in the change-logs.

eszthoff avatar Sep 30 '21 12:09 eszthoff

https://github.com/reactjs/react-modal/pull/887/files :/

DanielRitvas avatar Oct 14 '21 10:10 DanielRitvas