Skip to content

Latest commit

 

History

History
30 lines (15 loc) · 599 Bytes

findWhere.md

File metadata and controls

30 lines (15 loc) · 599 Bytes

.findWhere(fn) => ShallowWrapper

Finds every node in the render tree that return true for the provided predicate function.

Arguments

  1. predicate (ShallowWrapper => Boolean): A predicate function called with the passed in wrapped nodes.

Returns

ShallowWrapper: A new wrapper that wraps the found nodes.

Example

const wrapper = shallow(<MyComponent />);
const complexComponents = wrapper.findWhere(n => typeof n.type() !== 'string');
expect(complexComponents).to.have.length(8);

Related Methods