mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Add unstable_strictModeLevel to test renderer (#20914)
Matches what we do for React DOM
This commit is contained in:
+6
-1
@@ -56,6 +56,7 @@ const {IsSomeRendererActing} = ReactSharedInternals;
|
||||
type TestRendererOptions = {
|
||||
createNodeMock: (element: React$Element<any>) => any,
|
||||
unstable_isConcurrent: boolean,
|
||||
unstable_strictModeLevel: number,
|
||||
...
|
||||
};
|
||||
|
||||
@@ -433,6 +434,7 @@ function propsMatch(props: Object, filter: Object): boolean {
|
||||
function create(element: React$Element<any>, options: TestRendererOptions) {
|
||||
let createNodeMock = defaultTestOptions.createNodeMock;
|
||||
let isConcurrent = false;
|
||||
let strictModeLevel = null;
|
||||
if (typeof options === 'object' && options !== null) {
|
||||
if (typeof options.createNodeMock === 'function') {
|
||||
createNodeMock = options.createNodeMock;
|
||||
@@ -440,6 +442,9 @@ function create(element: React$Element<any>, options: TestRendererOptions) {
|
||||
if (options.unstable_isConcurrent === true) {
|
||||
isConcurrent = true;
|
||||
}
|
||||
if (options.unstable_strictModeLevel !== undefined) {
|
||||
strictModeLevel = options.unstable_strictModeLevel;
|
||||
}
|
||||
}
|
||||
let container = {
|
||||
children: [],
|
||||
@@ -451,7 +456,7 @@ function create(element: React$Element<any>, options: TestRendererOptions) {
|
||||
isConcurrent ? ConcurrentRoot : LegacyRoot,
|
||||
false,
|
||||
null,
|
||||
null,
|
||||
strictModeLevel,
|
||||
);
|
||||
invariant(root != null, 'something went wrong');
|
||||
updateContainer(element, root, null, null);
|
||||
|
||||
Reference in New Issue
Block a user