diff --git a/packages/react-dom/src/__tests__/ReactLegacyUpdates-test.js b/packages/react-dom/src/__tests__/ReactLegacyUpdates-test.js
index 5cba05a83e35a..a989b17127783 100644
--- a/packages/react-dom/src/__tests__/ReactLegacyUpdates-test.js
+++ b/packages/react-dom/src/__tests__/ReactLegacyUpdates-test.js
@@ -11,7 +11,6 @@
let React;
let ReactDOM;
-let ReactTestUtils;
let act;
let Scheduler;
let assertLog;
@@ -23,7 +22,6 @@ describe('ReactLegacyUpdates', () => {
jest.resetModules();
React = require('react');
ReactDOM = require('react-dom');
- ReactTestUtils = require('react-dom/test-utils');
act = require('internal-test-utils').act;
Scheduler = require('scheduler');
@@ -47,7 +45,8 @@ describe('ReactLegacyUpdates', () => {
}
}
- const instance = ReactTestUtils.renderIntoDocument();
+ const container = document.createElement('div');
+ const instance = ReactDOM.render(, container);
expect(instance.state.x).toBe(0);
ReactDOM.unstable_batchedUpdates(function () {
@@ -77,7 +76,8 @@ describe('ReactLegacyUpdates', () => {
}
}
- const instance = ReactTestUtils.renderIntoDocument();
+ const container = document.createElement('div');
+ const instance = ReactDOM.render(, container);
expect(instance.state.x).toBe(0);
expect(instance.state.y).toBe(0);
@@ -163,7 +163,8 @@ describe('ReactLegacyUpdates', () => {
}
}
- const instance = ReactTestUtils.renderIntoDocument();
+ const container = document.createElement('div');
+ const instance = ReactDOM.render(, container);
const child = instance.childRef.current;
expect(instance.state.x).toBe(0);
expect(child.state.y).toBe(0);
@@ -218,7 +219,8 @@ describe('ReactLegacyUpdates', () => {
}
}
- const instance = ReactTestUtils.renderIntoDocument();
+ const container = document.createElement('div');
+ const instance = ReactDOM.render(, container);
const child = instance.childRef.current;
expect(instance.state.x).toBe(0);
expect(child.state.y).toBe(0);
@@ -256,7 +258,8 @@ describe('ReactLegacyUpdates', () => {
}
}
- const instance = ReactTestUtils.renderIntoDocument();
+ const container = document.createElement('div');
+ const instance = ReactDOM.render(, container);
expect(instance.state.x).toBe(0);
let innerCallbackRun = false;
@@ -301,7 +304,8 @@ describe('ReactLegacyUpdates', () => {
}
}
- const instance = ReactTestUtils.renderIntoDocument();
+ const container = document.createElement('div');
+ const instance = ReactDOM.render(, container);
expect(instance.state.x).toBe(0);
let callbacksRun = 0;
@@ -351,8 +355,8 @@ describe('ReactLegacyUpdates', () => {
expect(parentRenderCount).toBe(0);
expect(childRenderCount).toBe(0);
- let instance = ;
- instance = ReactTestUtils.renderIntoDocument(instance);
+ const container = document.createElement('div');
+ const instance = ReactDOM.render(, container);
expect(parentRenderCount).toBe(1);
expect(childRenderCount).toBe(1);
@@ -405,7 +409,8 @@ describe('ReactLegacyUpdates', () => {
}
}
- ReactTestUtils.renderIntoDocument();
+ const container = document.createElement('div');
+ ReactDOM.render(, container);
expect(numMiddleRenders).toBe(2);
expect(numBottomRenders).toBe(1);
});
@@ -478,8 +483,8 @@ describe('ReactLegacyUpdates', () => {
}
Object.assign(App.prototype, UpdateLoggingMixin);
- let root = ;
- root = ReactTestUtils.renderIntoDocument(root);
+ const container = document.createElement('div');
+ const root = ReactDOM.render(, container);
function expectUpdates(desiredWillUpdates, desiredDidUpdates) {
let i;
@@ -581,7 +586,8 @@ describe('ReactLegacyUpdates', () => {
}
}
- const a = ReactTestUtils.renderIntoDocument();
+ const container = document.createElement('div');
+ const a = ReactDOM.render(, container);
ReactDOM.unstable_batchedUpdates(function () {
a.setState({x: 1});
b.setState({x: 1});
@@ -630,7 +636,8 @@ describe('ReactLegacyUpdates', () => {
}
}
- const instance = ReactTestUtils.renderIntoDocument();
+ const container = document.createElement('div');
+ const instance = ReactDOM.render(, container);
updates.push('Outer-setState-1');
instance.setState({x: 1}, function () {
@@ -698,7 +705,8 @@ describe('ReactLegacyUpdates', () => {
}
}
- ReactTestUtils.renderIntoDocument();
+ const container = document.createElement('div');
+ ReactDOM.render(, container);
expect(updates).toEqual([0, 1, 2]);
@@ -758,8 +766,10 @@ describe('ReactLegacyUpdates', () => {
}
}
- const x = ReactTestUtils.renderIntoDocument();
- const y = ReactTestUtils.renderIntoDocument();
+ let container = document.createElement('div');
+ const x = ReactDOM.render(, container);
+ container = document.createElement('div');
+ const y = ReactDOM.render(, container);
expect(ReactDOM.findDOMNode(x).textContent).toBe('0');
y.forceUpdate();
@@ -794,11 +804,14 @@ describe('ReactLegacyUpdates', () => {
}
ReactDOM.unstable_batchedUpdates(function () {
- ReactTestUtils.renderIntoDocument(
+ const container = document.createElement('div');
+
+ ReactDOM.render(
,
+ container,
);
});
@@ -859,7 +872,8 @@ describe('ReactLegacyUpdates', () => {
}
}
- const component = ReactTestUtils.renderIntoDocument();
+ const container = document.createElement('div');
+ const component = ReactDOM.render(, container);
ReactDOM.unstable_batchedUpdates(function () {
// B will have scheduled an update but the batching should ensure that its
@@ -886,7 +900,8 @@ describe('ReactLegacyUpdates', () => {
}
}
- let component = ReactTestUtils.renderIntoDocument();
+ let container = document.createElement('div');
+ let component = ReactDOM.render(, container);
expect(() => {
expect(() => component.setState({}, 'no')).toErrorDev(
@@ -897,7 +912,8 @@ describe('ReactLegacyUpdates', () => {
'Invalid argument passed as callback. Expected a function. Instead ' +
'received: no',
);
- component = ReactTestUtils.renderIntoDocument();
+ container = document.createElement('div');
+ component = ReactDOM.render(, container);
expect(() => {
expect(() => component.setState({}, {foo: 'bar'})).toErrorDev(
'Expected the last optional `callback` argument to be ' +
@@ -908,7 +924,8 @@ describe('ReactLegacyUpdates', () => {
'received: [object Object]',
);
// Make sure the warning is deduplicated and doesn't fire again
- component = ReactTestUtils.renderIntoDocument();
+ container = document.createElement('div');
+ component = ReactDOM.render(, container);
expect(() => component.setState({}, new Foo())).toThrowError(
'Invalid argument passed as callback. Expected a function. Instead ' +
'received: [object Object]',
@@ -930,7 +947,8 @@ describe('ReactLegacyUpdates', () => {
}
}
- let component = ReactTestUtils.renderIntoDocument();
+ let container = document.createElement('div');
+ let component = ReactDOM.render(, container);
expect(() => {
expect(() => component.forceUpdate('no')).toErrorDev(
@@ -941,7 +959,8 @@ describe('ReactLegacyUpdates', () => {
'Invalid argument passed as callback. Expected a function. Instead ' +
'received: no',
);
- component = ReactTestUtils.renderIntoDocument();
+ container = document.createElement('div');
+ component = ReactDOM.render(, container);
expect(() => {
expect(() => component.forceUpdate({foo: 'bar'})).toErrorDev(
'Expected the last optional `callback` argument to be ' +
@@ -952,7 +971,8 @@ describe('ReactLegacyUpdates', () => {
'received: [object Object]',
);
// Make sure the warning is deduplicated and doesn't fire again
- component = ReactTestUtils.renderIntoDocument();
+ container = document.createElement('div');
+ component = ReactDOM.render(, container);
expect(() => component.forceUpdate(new Foo())).toThrowError(
'Invalid argument passed as callback. Expected a function. Instead ' +
'received: [object Object]',
@@ -1004,7 +1024,8 @@ describe('ReactLegacyUpdates', () => {
}
}
- const parent = ReactTestUtils.renderIntoDocument();
+ const container = document.createElement('div');
+ const parent = ReactDOM.render(, container);
const child = parent.getChild();
ReactDOM.unstable_batchedUpdates(function () {
parent.forceUpdate();