-
-
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.
Add tap() into ShallowWrapper and ReactWrapper
- Loading branch information
Showing
6 changed files
with
121 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# `.tap(intercepter) => Self` | ||
|
||
Invokes intercepter and returns itself. intercepter is called with itself. | ||
This is helpful when debugging nodes in method chains. | ||
|
||
#### Arguments | ||
|
||
1. `intercepter` (`Self`): the current ReactWrapper instance. | ||
|
||
|
||
|
||
#### Returns | ||
|
||
`Self`: the current ReactWrapper instance. | ||
|
||
|
||
|
||
#### Example | ||
|
||
|
||
```jsx | ||
const result = mount( | ||
<ul> | ||
<li>xxx</li> | ||
<li>yyy</li> | ||
<li>zzz</li> | ||
</ul> | ||
) | ||
.find('li') | ||
.tap(n => console.log(n.debug())) | ||
.map(n => n.text()) | ||
; | ||
``` |
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,33 @@ | ||
# `.tap(intercepter) => Self` | ||
|
||
Invokes intercepter and returns itself. intercepter is called with itself. | ||
This is helpful when debugging nodes in method chains. | ||
|
||
#### Arguments | ||
|
||
1. `intercepter` (`Self`): the current ShallowWrapper instance. | ||
|
||
|
||
|
||
#### Returns | ||
|
||
`Self`: the current ShallowWrapper instance. | ||
|
||
|
||
|
||
#### Example | ||
|
||
|
||
```jsx | ||
const result = shallow( | ||
<ul> | ||
<li>xxx</li> | ||
<li>yyy</li> | ||
<li>zzz</li> | ||
</ul> | ||
) | ||
.find('li') | ||
.tap(n => console.log(n.debug())) | ||
.map(n => n.text()) | ||
; | ||
``` |
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