Disable and then wrapper.mount () doesn't work as expected again in Enzyme
Enzyme: 2.8.2 React: 15.5.4
If we do wrapper.unmount () and then wrapper.mount (), the component is not properly mounted. After installation, you can see an empty console output again.
Simple example:
class Foo extends React.Component {
constructor(props) {
super(props);
}
render() {
return (
<div className={this.props.id}>
{this.props.id}
</div>
);
}
}
const wrapper = mount(<Foo id="foo" />);
console.log("log before unmounting", wrapper.mount().debug()); //This logs the component properly
wrapper.unmount();
console.log("Log again after mounting", wrapper.mount().debug());//this logs empty component
+3
source to share
No one has answered this question yet
Check out similar questions: