Skip to content

Commit 2ec36a4

Browse files
committed
Fix ReactSuspense test too
1 parent 0102ecb commit 2ec36a4

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

packages/react-reconciler/src/__tests__/ReactSuspense-test.internal.js

+7-9
Original file line numberDiff line numberDiff line change
@@ -314,32 +314,30 @@ describe('ReactSuspense', () => {
314314
}, 290);
315315

316316
// Render an empty shell
317-
const root = ReactTestRenderer.create(<Foo />, {
318-
isConcurrent: true,
319-
});
320-
317+
const root = ReactDOMClient.createRoot(container);
318+
root.render(<Foo />);
321319
await waitForAll(['Foo', 'Suspend! [A]', 'Loading...']);
322-
expect(root).toMatchRenderedOutput('Loading...');
320+
expect(container.textContent).toEqual('Loading...');
323321

324322
// Now resolve A
325323
jest.advanceTimersByTime(290);
326324
await waitFor(['A']);
327-
expect(root).toMatchRenderedOutput('Loading...');
325+
expect(container.textContent).toEqual('Loading...');
328326

329327
// B starts loading. Parent boundary is in throttle.
330328
// Still shows parent loading under throttle
331329
jest.advanceTimersByTime(10);
332330
await waitForAll(['Suspend! [B]', 'Loading more...']);
333-
expect(root).toMatchRenderedOutput('Loading...');
331+
expect(container.textContent).toEqual('Loading...');
334332

335333
// !! B could have finished before the throttle, but we show a fallback.
336334
// !! Pushing out the 30ms fetch for B to 300ms.
337335
jest.advanceTimersByTime(300);
338336
await waitFor(['B']);
339-
expect(root).toMatchRenderedOutput('ALoading more...');
337+
expect(container.textContent).toEqual('ALoading more...');
340338

341339
await act(() => {});
342-
expect(root).toMatchRenderedOutput('AB');
340+
expect(container.textContent).toEqual('AB');
343341
});
344342

345343
it('does not throttle fallback committing for too long', async () => {

0 commit comments

Comments
 (0)