Spec-Zone.ru › Enzyme

.findWhere(fn) => ReactWrapper

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

Arguments

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

Returns

ReactWrapper: A new wrapper that wraps the found nodes.

Example

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

Related Methods

  • .find(selector) => ReactWrapper

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

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API