You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: website/docs/12.x/docs/api/misc/async.mdx
-14
Original file line number
Diff line number
Diff line change
@@ -53,12 +53,6 @@ Avoiding side effects in `expectation` callback can be partially enforced with t
53
53
54
54
It is also recommended to have a [single assertion per each `waitFor`](https://kentcdodds.com/blog/common-mistakes-with-react-testing-library#having-multiple-assertions-in-a-single-waitfor-callback) for more consistency and faster failing tests. If you want to make several assertions, then they should be in seperate `waitFor` calls. In many cases you won't actually need to wrap the second assertion in `waitFor` since the first one will do the waiting required for asynchronous change to happen.
55
55
56
-
### Using a React Native version < 0.71 with Jest fake timers
57
-
58
-
:::caution
59
-
When using a version of React Native < 0.71 and modern fake timers (the default for `Jest` >= 27), `waitFor` won't work (it will always timeout even if `expectation()` doesn't throw) unless you use the custom [@testing-library/react-native preset](https://github.com/callstack/react-native-testing-library#custom-jest-preset).
60
-
:::
61
-
62
56
`waitFor` checks whether Jest fake timers are enabled and adapts its behavior in such case. The following snippet is a simplified version of how it behaves when fake timers are enabled:
63
57
64
58
```tsx
@@ -96,10 +90,6 @@ await waitFor(() => {
96
90
}, 10000);
97
91
```
98
92
99
-
:::info
100
-
In order to properly use `waitFor` you need at least React >=16.9.0 (featuring async `act`) or React Native >=0.61 (which comes with React >=16.9.0).
101
-
:::
102
-
103
93
:::note
104
94
If you receive warnings related to `act()` function consult our [Undestanding Act](docs/advanced/understanding-act.md) function document.
105
95
:::
@@ -129,10 +119,6 @@ This method expects that the element is initially present in the render tree and
129
119
130
120
You can use any of `getBy`, `getAllBy`, `queryBy` and `queryAllBy` queries for `expectation` parameter.
131
121
132
-
:::info
133
-
In order to properly use `waitForElementToBeRemoved` you need at least React >=16.9.0 (featuring async `act`) or React Native >=0.61 (which comes with React >=16.9.0).
134
-
:::
135
-
136
122
:::note
137
123
If you receive warnings related to `act()` function consult our [Undestanding Act](docs/advanced/understanding-act.md) function document.
@@ -45,7 +38,7 @@ expect(view).toBeDisabled(); // Assert its accessibility state
45
38
46
39
This deprecated query has been removed as is typically too general to give meaningful results. Use one of the following options:
47
40
48
-
-[`toHaveAccessibilityValue()`](jest-matchers#tohaveaccessibilityvalue) Jest matcher to check the state of element found using some other query
41
+
-[`toHaveAccessibilityValue()`](docs/api/jest-matchers#tohaveaccessibilityvalue) Jest matcher to check the state of element found using some other query
For a time being we didn't support shallow rendering. Now we are removing the last remains of it: `debug.shallow()`. If you are interested in shallow rendering see [here](migration-v2#removed-global-shallow-function).
58
+
For a time being we didn't support shallow rendering. Now we are removing the last remains of it: `debug.shallow()`. If you are interested in shallow rendering see [here](docs/migration/previous/v2#removed-global-shallow-function).
66
59
67
60
# Other changes
68
61
@@ -72,4 +65,4 @@ This should not break any tests.
0 commit comments