diff --git a/packages/react-reconciler/src/__tests__/ReactTransition-test.internal.js b/packages/react-reconciler/src/__tests__/ReactTransition-test.internal.js index d6e26be4ad..22451a3bbe 100644 --- a/packages/react-reconciler/src/__tests__/ReactTransition-test.internal.js +++ b/packages/react-reconciler/src/__tests__/ReactTransition-test.internal.js @@ -19,7 +19,7 @@ let useState; let useTransition; let act; -describe('ReactHooksWithNoopRenderer', () => { +describe('ReactTransition', () => { beforeEach(() => { jest.resetModules(); @@ -59,44 +59,47 @@ describe('ReactHooksWithNoopRenderer', () => { return Component; } - it('isPending works even if called from outside an input event', async () => { - const Async = createAsyncText('Async'); - let start; - function App() { - const [show, setShow] = useState(false); - const [startTransition, isPending] = useTransition(); - start = () => startTransition(() => setShow(true)); - return ( - }> - {isPending ? : null} - {show ? : } - - ); - } + it.experimental( + 'isPending works even if called from outside an input event', + async () => { + const Async = createAsyncText('Async'); + let start; + function App() { + const [show, setShow] = useState(false); + const [startTransition, isPending] = useTransition(); + start = () => startTransition(() => setShow(true)); + return ( + }> + {isPending ? : null} + {show ? : } + + ); + } - const root = ReactNoop.createRoot(); + const root = ReactNoop.createRoot(); - await act(async () => { - root.render(); - }); - expect(Scheduler).toHaveYielded(['(empty)']); - expect(root).toMatchRenderedOutput('(empty)'); + await act(async () => { + root.render(); + }); + expect(Scheduler).toHaveYielded(['(empty)']); + expect(root).toMatchRenderedOutput('(empty)'); - await act(async () => { - start(); + await act(async () => { + start(); - expect(Scheduler).toFlushAndYield([ - 'Pending...', - '(empty)', - 'Suspend! [Async]', - 'Loading...', - ]); + expect(Scheduler).toFlushAndYield([ + 'Pending...', + '(empty)', + 'Suspend! [Async]', + 'Loading...', + ]); - expect(root).toMatchRenderedOutput('Pending...(empty)'); + expect(root).toMatchRenderedOutput('Pending...(empty)'); - await Async.resolve(); - }); - expect(Scheduler).toHaveYielded(['Async']); - expect(root).toMatchRenderedOutput('Async'); - }); + await Async.resolve(); + }); + expect(Scheduler).toHaveYielded(['Async']); + expect(root).toMatchRenderedOutput('Async'); + }, + ); });