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
Enzyme recently picked up changes in v2.6.0 that remove the need for .update() in the shallow wrapper for a lot of cases. It accomplishes this by replacing the node and nodes properties with functions (getNode and getNodes) that always return the latest output of the underlying shallow renderer.
To keep back-compat with other versions of enzyme, one could simply check for .getNode and fall back to .node if it's not there.
Example:
constwrapper=shallow(<MyComponent/>);wrapper.find(Child).props().methodThatSetsStateOnMyComponent();wrapper.update();//shallow DOM won't be updated in the snapshot without thisexpect(shallowToJson(wrapper)).toMatchSnapshot();
With the proposed change, we wouldn't need the .update() call.
The text was updated successfully, but these errors were encountered:
Enzyme recently picked up changes in v2.6.0 that remove the need for .update() in the shallow wrapper for a lot of cases. It accomplishes this by replacing the node and nodes properties with functions (getNode and getNodes) that always return the latest output of the underlying shallow renderer.
To keep back-compat with other versions of enzyme, one could simply check for .getNode and fall back to .node if it's not there.
Example:
With the proposed change, we wouldn't need the .update() call.
The text was updated successfully, but these errors were encountered: