Edit This Page

.someWhere(fn) => Boolean

Returns whether or not any of the nodes in the wrapper pass the provided predicate function.


  1. predicate (ShallowWrapper => Boolean): A predicate function to match the nodes.


Boolean: True if at least one of the nodes in the current wrapper passed the predicate function.


const wrapper = shallow(
    <div className="foo qoo" />
    <div className="foo boo" />
    <div className="foo hoo" />
expect(wrapper.find('.foo').someWhere(n => n.hasClass('qoo'))).to.equal(true);
expect(wrapper.find('.foo').someWhere(n => n.hasClass('foo'))).to.equal(true);
expect(wrapper.find('.foo').someWhere(n => n.hasClass('bar'))).to.equal(false);