W3cubDocs

/Enzyme

.filter(selector) => ReactWrapper

Returns a new wrapper with only the nodes of the current wrapper that match the provided selector.

Arguments

  1. selector (EnzymeSelector): The selector to match.

Returns

ReactWrapper: A new wrapper that wraps the filtered nodes.

Examples

const wrapper = mount(<MyComponent />);
expect(wrapper.find('.foo').filter('.bar')).to.have.lengthOf(1);

© 2015 Airbnb, Inc.
Licensed under the MIT License.
https://airbnb.io/enzyme/docs/api/ReactWrapper/filter.html