Skip to content

Commit f6f6c10

Browse files
tam315Kent C. Dodds
authored andcommitted
Add some async API's to the cheatsheet (testing-library#139)
* sync cheatsheet with react-testing-library's one * add link to the API document * add async utilities document * fix description * chenge description for waitForElement * remove dots * add 'the'
1 parent 9d5e55e commit f6f6c10

File tree

2 files changed

+22
-11
lines changed

2 files changed

+22
-11
lines changed

docs/dom-testing-library/cheatsheet.md

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,19 @@ See [Which query should I use?](guide-which-query.md)
7777

7878
## Async
7979

80-
See [Async API](api-async.md)
81-
82-
- **wait** retry function within until it stops throwing or times out
83-
- **waitForElement** retry function or array of functions and return the result
84-
- `findBy` and `findAllBy` queries are async and retry until either a timeout or
85-
if the query returns successfully; they wrap `waitForElement`
80+
See [Async API](dom-testing-library/api-async.md)
81+
82+
- **wait** (Promise) retry the function within until it stops throwing or times
83+
out
84+
- **waitForElement** (Promise) retry the function until it returns an element or
85+
an array of elements
86+
- `findBy` and `findAllBy` queries are async and retry until either a timeout
87+
or if the query returns successfully; they wrap `waitForElement`
88+
- **waitForDomChange** (Promise) retry the function each time the DOM is changed
89+
- **waitForElementToBeRemoved** (Promise) retry the function until it no longer
90+
returns a DOM node
91+
92+
> Remember to `await` or `.then()` the result of async functions in your tests!
8693
8794
## Events
8895

docs/react-testing-library/cheatsheet.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,15 @@ See [Which query should I use?](guide-which-query.md)
108108

109109
See [dom-testing-library Async API](dom-testing-library/api-async.md)
110110

111-
- **wait** (Promise) retry function within until it stops throwing or times out
112-
- **waitForElement** (Promise) retry function or array of functions and return
113-
the result
114-
- `findBy` and `findAllBy` queries are async and retry until either a timeout or
115-
if the query returns successfully; they wrap `waitForElement`.
111+
- **wait** (Promise) retry the function within until it stops throwing or times
112+
out
113+
- **waitForElement** (Promise) retry the function until it returns an element or
114+
an array of elements
115+
- `findBy` and `findAllBy` queries are async and retry until either a timeout
116+
or if the query returns successfully; they wrap `waitForElement`
117+
- **waitForDomChange** (Promise) retry the function each time the DOM is changed
118+
- **waitForElementToBeRemoved** (Promise) retry the function until it no longer
119+
returns a DOM node
116120

117121
> Remember to `await` or `.then()` the result of async functions in your tests!
118122

0 commit comments

Comments
 (0)