@samitouri / QOS-React-2 / commits / 1f2da0babd

Forgot to mark test as experimental (#17391)

Andrew Clark committed Nov 17, 2019 at 13:59 UTC 1f2da0babd723f1b479f84cef5a0ea4fedac3959
1 file changed +38 -35
packages/react-reconciler/src/__tests__/ReactTransition-test.internal.js
+38 -35
@@ -19,7 +19,7 @@ let useState;
19 let useTransition;
20 let act;
21
22 -describe('ReactHooksWithNoopRenderer', () => {
22 +describe('ReactTransition', () => {
23 beforeEach(() => {
24 jest.resetModules();
25
@@ -59,44 +59,47 @@ describe('ReactHooksWithNoopRenderer', () => {
59 return Component;
60 }
61
62 - it('isPending works even if called from outside an input event', async () => {
63 - const Async = createAsyncText('Async');
64 - let start;
65 - function App() {
66 - const [show, setShow] = useState(false);
67 - const [startTransition, isPending] = useTransition();
68 - start = () => startTransition(() => setShow(true));
69 - return (
70 - <Suspense fallback={<Text text="Loading..." />}>
71 - {isPending ? <Text text="Pending..." /> : null}
72 - {show ? <Async /> : <Text text="(empty)" />}
73 - </Suspense>
74 - );
75 - }
62 + it.experimental(
63 + 'isPending works even if called from outside an input event',
64 + async () => {
65 + const Async = createAsyncText('Async');
66 + let start;
67 + function App() {
68 + const [show, setShow] = useState(false);
69 + const [startTransition, isPending] = useTransition();
70 + start = () => startTransition(() => setShow(true));
71 + return (
72 + <Suspense fallback={<Text text="Loading..." />}>
73 + {isPending ? <Text text="Pending..." /> : null}
74 + {show ? <Async /> : <Text text="(empty)" />}
75 + </Suspense>
76 + );
77 + }
78
77 - const root = ReactNoop.createRoot();
79 + const root = ReactNoop.createRoot();
80
79 - await act(async () => {
80 - root.render(<App />);
81 - });
82 - expect(Scheduler).toHaveYielded(['(empty)']);
83 - expect(root).toMatchRenderedOutput('(empty)');
81 + await act(async () => {
82 + root.render(<App />);
83 + });
84 + expect(Scheduler).toHaveYielded(['(empty)']);
85 + expect(root).toMatchRenderedOutput('(empty)');
86
85 - await act(async () => {
86 - start();
87 + await act(async () => {
88 + start();
89
88 - expect(Scheduler).toFlushAndYield([
89 - 'Pending...',
90 - '(empty)',
91 - 'Suspend! [Async]',
92 - 'Loading...',
93 - ]);
90 + expect(Scheduler).toFlushAndYield([
91 + 'Pending...',
92 + '(empty)',
93 + 'Suspend! [Async]',
94 + 'Loading...',
95 + ]);
96
95 - expect(root).toMatchRenderedOutput('Pending...(empty)');
97 + expect(root).toMatchRenderedOutput('Pending...(empty)');
98
97 - await Async.resolve();
98 - });
99 - expect(Scheduler).toHaveYielded(['Async']);
100 - expect(root).toMatchRenderedOutput('Async');
101 - });
99 + await Async.resolve();
100 + });
101 + expect(Scheduler).toHaveYielded(['Async']);
102 + expect(root).toMatchRenderedOutput('Async');
103 + },
104 + );
105 });