Returns whether or not the current wrapper root node render tree looks like the one passed in.
node
(ReactElement
): The node whose presence you are detecting in the current instance's render tree.Boolean
: whether or not the current wrapper has a node anywhere in it's render tree that looks like the one passed in.
const wrapper = mount(<MyComponent />); expect(wrapper.equals(<div className="foo bar" />)).to.equal(true);
.equals()
expects a ReactElement, not a selector (like many other methods). Make sure that when you are calling it you are calling it with a ReactElement or a JSX expression..equals()
ignores properties whose values are undefined
.
© 2015 Airbnb, Inc.
Licensed under the MIT License.
https://airbnb.io/enzyme/docs/api/ReactWrapper/equals.html