enzyme
Version:
JavaScript Testing utilities for React
31 lines (15 loc) • 643 B
Markdown
Returns a new wrapper with only the nodes of the current wrapper that, when passed into the
provided predicate function, return true.
1. `predicate` (`ShallowWrapper => Boolean`): A predicate function that is passed a wrapped node.
`ShallowWrapper`: A new wrapper that wraps the filtered nodes.
```jsx
const wrapper = shallow(<MyComponent />);
const complexFoo = wrapper.find('.foo').filterWhere(n => typeof n.type() !== 'string');
expect(complexFoo).to.have.length(4);
```
- [`.filter(selector) => ShallowWrapper`](filter.md)