Skip to content
This repository has been archived by the owner on Jul 26, 2024. It is now read-only.

Latest commit

 

History

History
32 lines (18 loc) · 792 Bytes

parents.md

File metadata and controls

32 lines (18 loc) · 792 Bytes

.parents([selector]) => ReactWrapper

Returns a wrapper around all of the parents/ancestors of the wrapper. Does not include the node in the current wrapper. Optionally, a selector can be provided and it will filter the parents by this selector

Note: can only be called on a wrapper of a single node.

Arguments

  1. selector (EnzymeSelector [optional]): The selector to filter the parents by.

Returns

ReactWrapper: A new wrapper that wraps the resulting nodes.

Examples

const wrapper = mount(<ToDoList />);
expect(wrapper.find('ul').parents()).to.have.length(2);

Related Methods