-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Now you can filter the childrens by a number, which would be equivalent to use the `at()` method. `.children(0)` === `children().at(0)`; update the children docs remove comment update the api This commit undo the changes I've done to the `children` method, and created a new method named `childAt`. update the docs update docs and test description update api and tests update docs
- Loading branch information
1 parent
995f142
commit da803c4
Showing
11 changed files
with
114 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# `.childAt(index) => ReactWrapper` | ||
|
||
Returns a new wrapper with child at the specified index. | ||
|
||
#### Arguments | ||
|
||
1. `index` (`number`): A zero-based integer indicating which node to retrieve. | ||
|
||
|
||
#### Returns | ||
|
||
`ReactWrapper`: A new wrapper that wraps the resulting node. | ||
|
||
|
||
|
||
#### Examples | ||
|
||
```jsx | ||
const wrapper = mount(<ToDoList items={items} />); | ||
expect(wrapper.find('ul').childAt(0).type()).to.equal('li'); | ||
``` | ||
|
||
#### Related Methods | ||
|
||
- [`.parents() => ReactWrapper`](parents.md) | ||
- [`.parent() => ReactWrapper`](parent.md) | ||
- [`.closest(selector) => ReactWrapper`](closest.md) | ||
- [`.children() => ReactWrapper`](children.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# `.childAt(index) => ShallowWrapper` | ||
|
||
Returns a new wrapper with child at the specified index. | ||
|
||
#### Arguments | ||
|
||
1. `index` (`number`): A zero-based integer indicating which node to retrieve. | ||
|
||
|
||
#### Returns | ||
|
||
`ShallowWrapper`: A new wrapper that wraps the resulting node. | ||
|
||
|
||
|
||
#### Examples | ||
|
||
```jsx | ||
const wrapper = shallow(<ToDoList items={items} />); | ||
expect(wrapper.find('ul').childAt(0).type()).to.equal('li'); | ||
``` | ||
|
||
#### Related Methods | ||
|
||
- [`.parents() => ShallowWrapper`](parents.md) | ||
- [`.parent() => ShallowWrapper`](parent.md) | ||
- [`.closest(selector) => ShallowWrapper`](closest.md) | ||
- [`.children() => ReactWrapper`](children.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters