You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm Running into issues with snapshot testing due to Button being an ES6 class extend of tooltip. Debugging Button/Tooltip. May need to refactor button a little. It's been on my mind for a while now.
It appears that Jest snapshots testing can't make any calls to focus or possibly all DOM references. This appears to be the issues: jestjs/jest#1353 (comment)
React’s test renderer module which is the default renderer for Jest snapshots does not implement a DOM, not even a JSDOM (which is what Enzyme does if not in a browser). Any components that use .focus(), portal mounts, or possibly any ReactDOM calls? cannot use Jest snapshot in its default implementation. Some folks are saying that newer versions of React/ReactDOM make TestRenderer work properly, but I’m not sure. Using Enzyme/JSDOM to get the HTML might be the way to go: https://github.com/adriantoine/enzyme-to-json or at least seems to be the “off the shelf” fix.
This project uses .findDOMnode() about 50 times (90% for focus)! I'm guessing we should be using props and callbacks like focusOnInput and then onFocusInput to reset the prop? Then, we'd put the .focus() on the actual node this.input through a ref.
Another options would be that callbacks get passed down as props and get called in the child and the component ref gets passed in.
This looks to be the preferred implementation. Use ref callbacks to pass child DOM nodes to parent: reduxjs/react-redux#266 (comment)
On a related note onClickOutside needs to removed from components in order to have Jest test it. Pointing directly to components/datepicker/datepicker works.
The text was updated successfully, but these errors were encountered:
I'm Running into issues with snapshot testing due to Button being an ES6 class extend of tooltip. Debugging Button/Tooltip. May need to refactor button a little. It's been on my mind for a while now.
It appears that Jest snapshots testing can't make any calls to focus or possibly all DOM references. This appears to be the issues: jestjs/jest#1353 (comment)
React’s test renderer module which is the default renderer for Jest snapshots does not implement a DOM, not even a JSDOM (which is what Enzyme does if not in a browser). Any components that use
.focus()
, portal mounts, or possibly any ReactDOM calls? cannot use Jest snapshot in its default implementation. Some folks are saying that newer versions of React/ReactDOM make TestRenderer work properly, but I’m not sure. Using Enzyme/JSDOM to get the HTML might be the way to go: https://github.com/adriantoine/enzyme-to-json or at least seems to be the “off the shelf” fix.Also, an interesting comment from last July https://twitter.com/dan_abramov/status/752950507690455040
This project uses
.findDOMnode()
about 50 times (90% for focus)! I'm guessing we should be using props and callbacks likefocusOnInput
and thenonFocusInput
to reset the prop? Then, we'd put the.focus()
on the actual nodethis.input
through a ref.Another options would be that callbacks get passed down as props and get called in the child and the component ref gets passed in.
This looks to be the preferred implementation. Use ref callbacks to pass child DOM nodes to parent:
reduxjs/react-redux#266 (comment)
On a related note
onClickOutside
needs to removed from components in order to have Jest test it. Pointing directly tocomponents/datepicker/datepicker
works.The text was updated successfully, but these errors were encountered: