-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
15 additions
and
312 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
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 was deleted.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -4,11 +4,9 @@ import { | |
getQueriesForElement, | ||
prettyDOM, | ||
configure as configureDTL, | ||
waitForElementToBeRemoved as waitForElementToBeRemovedDTL, | ||
} from '@testing-library/dom' | ||
import act from './act-compat' | ||
import {fireEvent} from './fire-event' | ||
import {waitFor} from './wait-for' | ||
|
||
configureDTL({ | ||
eventWrapper: cb => { | ||
|
@@ -20,6 +18,15 @@ configureDTL({ | |
}, | ||
}) | ||
|
||
if (typeof React.startTransition !== undefined) { | ||
configureDTL({ | ||
unstable_advanceTimersWrapper: cb => { | ||
return act(cb) | ||
}, | ||
asyncWrapper: cb => cb(), | ||
}) | ||
} | ||
|
||
// Ideally we'd just use a WeakMap where containers are keys and roots are values. | ||
// We use two variables so that we can bail out in constant time when we render with a new container (most common use case) | ||
/** | ||
|
@@ -192,19 +199,9 @@ function cleanup() { | |
mountedContainers.clear() | ||
} | ||
|
||
function waitForElementToBeRemoved(callback, options) { | ||
return waitForElementToBeRemovedDTL(() => { | ||
let result | ||
act(() => { | ||
result = callback() | ||
}) | ||
return result | ||
}, options) | ||
} | ||
|
||
// just re-export everything from dom-testing-library | ||
export * from '@testing-library/dom' | ||
export {render, cleanup, act, fireEvent, waitFor, waitForElementToBeRemoved} | ||
export {render, cleanup, act, fireEvent} | ||
|
||
// NOTE: we're not going to export asyncAct because that's our own compatibility | ||
// thing for people using [email protected]. Anyone else doesn't need it and | ||
|
This file was deleted.
Oops, something went wrong.