@@ -4,11 +4,9 @@ import {
4
4
getQueriesForElement ,
5
5
prettyDOM ,
6
6
configure as configureDTL ,
7
- waitForElementToBeRemoved as waitForElementToBeRemovedDTL ,
8
7
} from '@testing-library/dom'
9
8
import act from './act-compat'
10
9
import { fireEvent } from './fire-event'
11
- import { waitFor } from './wait-for'
12
10
13
11
configureDTL ( {
14
12
eventWrapper : cb => {
@@ -20,6 +18,15 @@ configureDTL({
20
18
} ,
21
19
} )
22
20
21
+ if ( typeof React . startTransition !== undefined ) {
22
+ configureDTL ( {
23
+ unstable_advanceTimersWrapper : cb => {
24
+ return act ( cb )
25
+ } ,
26
+ asyncWrapper : cb => cb ( ) ,
27
+ } )
28
+ }
29
+
23
30
// Ideally we'd just use a WeakMap where containers are keys and roots are values.
24
31
// We use two variables so that we can bail out in constant time when we render with a new container (most common use case)
25
32
/**
@@ -192,19 +199,9 @@ function cleanup() {
192
199
mountedContainers . clear ( )
193
200
}
194
201
195
- function waitForElementToBeRemoved ( callback , options ) {
196
- return waitForElementToBeRemovedDTL ( ( ) => {
197
- let result
198
- act ( ( ) => {
199
- result = callback ( )
200
- } )
201
- return result
202
- } , options )
203
- }
204
-
205
202
// just re-export everything from dom-testing-library
206
203
export * from '@testing-library/dom'
207
- export { render , cleanup , act , fireEvent , waitFor , waitForElementToBeRemoved }
204
+ export { render , cleanup , act , fireEvent }
208
205
209
206
// NOTE: we're not going to export asyncAct because that's our own compatibility
210
207
// thing for people using [email protected] . Anyone else doesn't need it and
0 commit comments