Skip to content

Commit cc91ef9

Browse files
jpennaalexkrolick
andauthored
Documentation: Update async section of cheatsheet (#594)
Co-authored-by: Alex Krolick <alexkrolick@users.noreply.github.com>
1 parent e39a9e6 commit cc91ef9

File tree

2 files changed

+15
-19
lines changed

2 files changed

+15
-19
lines changed

docs/dom-testing-library/cheatsheet.md

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

7878
## Async
7979

80-
See [Async API](dom-testing-library/api-async.md)
80+
See [Async API](dom-testing-library/api-async.md). Remember to `await` or `.then()`
81+
the result of async functions in your tests!
8182

82-
- **wait** (Promise) retry the function within until it stops throwing or times
83+
- **waitFor** (Promise) retry the function within until it stops throwing or times
8384
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
8985
- **waitForElementToBeRemoved** (Promise) retry the function until it no longer
9086
returns a DOM node
9187

92-
> Remember to `await` or `.then()` the result of async functions in your tests!
88+
> **Deprecated since v7.0.0:**
89+
> - **wait** (Promise) retry the function within until it stops throwing or times
90+
> - **waitForElement** (Promise) retry the function until it returns an element or
91+
> an array of elements
92+
> - `findBy` and `findAllBy` queries are async and retry until either a timeout
93+
> or if the query returns successfully; they wrap `waitForElement`
94+
> - **waitForDomChange** (Promise) retry the function each time the DOM is changed
9395
9496
## Events
9597

docs/react-testing-library/cheatsheet.md

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

108108
## Async
109109

110-
See [dom-testing-library Async API](dom-testing-library/api-async.md)
111-
112-
- **wait** (Promise) retry the function within until it stops throwing or times
113-
out
114-
- **waitForElement** (Promise) retry the function until it returns an element or
115-
an array of elements
116-
- `findBy` and `findAllBy` queries are async and retry until either a timeout
117-
or if the query returns successfully; they wrap `waitForElement`
118-
- **waitForDomChange** (Promise) retry the function each time the DOM is changed
110+
The [dom-testing-library Async API](dom-testing-library/api-async.md) is
111+
re-exported from React Testing Library.
112+
113+
- **waitFor** (Promise) retry the function within until it stops throwing or
114+
times out
119115
- **waitForElementToBeRemoved** (Promise) retry the function until it no longer
120116
returns a DOM node
121117

122-
> Remember to `await` or `.then()` the result of async functions in your tests!
123-
124118
## Events
125119

126120
See [Events API](dom-testing-library/api-events.md)

0 commit comments

Comments
 (0)