From 4c58fc2ad8f1055f9b543147b283e5a3f795fd27 Mon Sep 17 00:00:00 2001 From: Sebastian Silbermann Date: Fri, 19 Jan 2024 18:21:15 +0100 Subject: [PATCH] Convert ReactFreshMultipleRenderer to createRoot (#28000) --- .../ReactFreshMultipleRenderer-test.internal.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/packages/react-refresh/src/__tests__/ReactFreshMultipleRenderer-test.internal.js b/packages/react-refresh/src/__tests__/ReactFreshMultipleRenderer-test.internal.js index a3eeed7b338eb..630074adbf001 100644 --- a/packages/react-refresh/src/__tests__/ReactFreshMultipleRenderer-test.internal.js +++ b/packages/react-refresh/src/__tests__/ReactFreshMultipleRenderer-test.internal.js @@ -16,7 +16,8 @@ if (__DEV__) { ReactFreshRuntime = require('react-refresh/runtime'); ReactFreshRuntime.injectIntoGlobalHook(global); } -const ReactDOM = require('react-dom'); +const ReactDOMClient = require('react-dom/client'); +const act = require('internal-test-utils').act; jest.resetModules(); const ReactART = require('react-art'); @@ -41,7 +42,7 @@ describe('ReactFresh', () => { } }); - it('can update components managed by different renderers independently', () => { + it('can update components managed by different renderers independently', async () => { if (__DEV__) { const InnerV1 = function () { return ; @@ -59,7 +60,10 @@ describe('ReactFresh', () => { }; ReactFreshRuntime.register(OuterV1, 'Outer'); - ReactDOM.render(, container); + const root = ReactDOMClient.createRoot(container); + await act(() => { + root.render(); + }); const el = container.firstChild; const pathEl = el.querySelector('path'); expect(el.style.color).toBe('blue');