diff --git a/packages/react-dom/src/__tests__/ReactMultiChildText-test.js b/packages/react-dom/src/__tests__/ReactMultiChildText-test.js
index 529b61604fbb5..450d0383eb0fc 100644
--- a/packages/react-dom/src/__tests__/ReactMultiChildText-test.js
+++ b/packages/react-dom/src/__tests__/ReactMultiChildText-test.js
@@ -11,7 +11,6 @@
const React = require('react');
const ReactDOMClient = require('react-dom/client');
-const ReactTestUtils = require('react-dom/test-utils');
const act = require('internal-test-utils').act;
// Helpers
@@ -174,46 +173,67 @@ describe('ReactMultiChildText', () => {
]);
});
- it('should throw if rendering both HTML and children', () => {
- expect(function () {
- ReactTestUtils.renderIntoDocument(
-
ghjkl
,
- );
- }).toThrow();
+ it('should throw if rendering both HTML and children', async () => {
+ const container = document.createElement('div');
+ const root = ReactDOMClient.createRoot(container);
+ await expect(
+ act(() => {
+ root.render(
+ ghjkl
,
+ );
+ }),
+ ).rejects.toThrow();
});
- it('should render between nested components and inline children', () => {
- ReactTestUtils.renderIntoDocument(
-
-
-
-
-
- ,
- );
-
- expect(function () {
- ReactTestUtils.renderIntoDocument(
-
-
A
- ,
- );
- }).not.toThrow();
-
- expect(function () {
- ReactTestUtils.renderIntoDocument(
-
-
{['A']}
- ,
- );
- }).not.toThrow();
+ it('should render between nested components and inline children', async () => {
+ let container = document.createElement('div');
+ let root = ReactDOMClient.createRoot(container);
- expect(function () {
- ReactTestUtils.renderIntoDocument(
+ await act(() => {
+ root.render(
-
{['A', 'B']}
+
+
+
+
,
);
- }).not.toThrow();
+ });
+
+ container = document.createElement('div');
+ root = ReactDOMClient.createRoot(container);
+ await expect(
+ act(() => {
+ root.render(
+
+
A
+ ,
+ );
+ }),
+ ).resolves.not.toThrow();
+
+ container = document.createElement('div');
+ root = ReactDOMClient.createRoot(container);
+ await expect(
+ act(() => {
+ root.render(
+
+
{['A']}
+ ,
+ );
+ }),
+ ).resolves.not.toThrow();
+
+ container = document.createElement('div');
+ root = ReactDOMClient.createRoot(container);
+ await expect(
+ act(() => {
+ root.render(
+
+
{['A', 'B']}
+ ,
+ );
+ }),
+ ).resolves.not.toThrow();
});
});