To check the actual DOM node using React enzyme, we use the findDOMNode
and wrapper.instance
methods.
For instance, we write
import ReactDOM from "react-dom";
//...
const wrapper = mount(<input type="text" defaultValue="sup" />);
console.log(ReactDOM.findDOMNode(wrapper.instance()) === wrapper.instance());
to mount the input component with mount
.
Then we call ReactDOM.findDOMNode
with wrapper.instance()
to find the DOM node for the instance.
And we check that against wrapper.instance()
to see if it returns the same DOM node.