Skip to content

Latest commit

 

History

History
30 lines (15 loc) · 647 Bytes

filterWhere.md

File metadata and controls

30 lines (15 loc) · 647 Bytes

.filterWhere(fn) => ShallowWrapper

Returns a new wrapper with only the nodes of the current wrapper that, when passed into the provided predicate function, return true.

Arguments

  1. predicate (ShallowWrapper => Boolean): A predicate function that is passed a wrapped node.

Returns

ShallowWrapper: A new wrapper that wraps the filtered nodes.

Example

const wrapper = shallow(<MyComponent />);
const complexFoo = wrapper.find('.foo').filterWhere((n) => typeof n.type() !== 'string');
expect(complexFoo).to.have.lengthOf(4);

Related Methods