@samitouri / QOS-React / commits / ab02a03cad

[Fiber] Add some scheduling tests (#8171)

* Extend ReactNoop to handle multiple roots This lets us test scheduling between the roots. * Add a few first tests for scheduler

Dan Abramov committed Nov 1, 2016 at 14:35 UTC ab02a03cad1afcecfdb88bc4b1013b46bc51dff2
4 files changed +191 -59
src/renderers/noop/ReactNoop.js
+39 -10
@@ -34,7 +34,7 @@ var scheduledDeferredCallback = null;
34 const TERMINAL_TAG = 99;
35 const TEXT_TAG = 98;
36
37 -type Container = { rootID: number, children: Array<Instance | TextInstance> };
37 +type Container = { rootID: string, children: Array<Instance | TextInstance> };
38 type Props = { prop: any };
39 type Instance = { tag: 99, type: string, id: number, children: Array<Instance | TextInstance>, prop: any };
40 type TextInstance = { tag: 98, text: string };
@@ -145,19 +145,46 @@ var NoopRenderer = ReactFiberReconciler({
145
146 });
147
148 -var rootContainer = { rootID: 0, children: [] };
149 -
150 -var root = null;
148 +var rootContainers = new Map();
149 +var roots = new Map();
150 +var DEFAULT_ROOT_ID = '<default>';
151
152 var ReactNoop = {
153
154 - root: rootContainer,
154 + getChildren(rootID : string = DEFAULT_ROOT_ID) {
155 + const container = rootContainers.get(rootID);
156 + if (container) {
157 + return container.children;
158 + } else {
159 + return null;
160 + }
161 + },
162
163 + // Shortcut for testing a single root
164 render(element : ReactElement<any>, callback: ?Function) {
157 - if (!root) {
158 - root = NoopRenderer.mountContainer(element, rootContainer, callback);
165 + ReactNoop.renderToRootWithID(element, DEFAULT_ROOT_ID, callback);
166 + },
167 +
168 + renderToRootWithID(element : ReactElement<any>, rootID : string, callback : ?Function) {
169 + if (!roots.has(rootID)) {
170 + const container = { rootID: rootID, children: [] };
171 + rootContainers.set(rootID, container);
172 + const root = NoopRenderer.mountContainer(element, container, callback);
173 + roots.set(rootID, root);
174 } else {
160 - NoopRenderer.updateContainer(element, root, callback);
175 + const root = roots.get(rootID);
176 + if (root) {
177 + NoopRenderer.updateContainer(element, root, callback);
178 + }
179 + }
180 + },
181 +
182 + unmountRootWithID(rootID : string) {
183 + const root = roots.get(rootID);
184 + roots.delete(rootID);
185 + rootContainers.delete(rootID);
186 + if (root) {
187 + NoopRenderer.unmountContainer(root);
188 }
189 },
190
@@ -211,8 +238,10 @@ var ReactNoop = {
238 },
239
240 // Logs the current state of the tree.
214 - dumpTree() {
215 - if (!root) {
241 + dumpTree(rootID : string = DEFAULT_ROOT_ID) {
242 + const root = roots.get(rootID);
243 + const rootContainer = rootContainers.get(rootID);
244 + if (!root || !rootContainer) {
245 console.log('Nothing rendered yet.');
246 return;
247 }
src/renderers/shared/fiber/__tests__/ReactIncrementalScheduling-test.js new
+103
@@ -0,0 +1,103 @@
1 +/**
2 + * Copyright 2013-present, Facebook, Inc.
3 + * All rights reserved.
4 + *
5 + * This source code is licensed under the BSD-style license found in the
6 + * LICENSE file in the root directory of this source tree. An additional grant
7 + * of patent rights can be found in the PATENTS file in the same directory.
8 + *
9 + * @emails react-core
10 + */
11 +
12 +'use strict';
13 +
14 +var React;
15 +var ReactNoop;
16 +
17 +describe('ReactIncrementalScheduling', () => {
18 + beforeEach(() => {
19 + React = require('React');
20 + ReactNoop = require('ReactNoop');
21 + });
22 +
23 + function span(prop) {
24 + return { type: 'span', children: [], prop };
25 + }
26 +
27 + it('schedules multiple roots', () => {
28 + // Schedule one root
29 + ReactNoop.renderToRootWithID(<span prop="a:1" />, 'a');
30 + ReactNoop.flushDeferredPri(15);
31 + expect(ReactNoop.getChildren('a')).toEqual([span('a:1')]);
32 +
33 + // Schedule two roots
34 + ReactNoop.renderToRootWithID(<span prop="a:2" />, 'a');
35 + ReactNoop.renderToRootWithID(<span prop="b:2" />, 'b');
36 + // First scheduled one gets processed first
37 + ReactNoop.flushDeferredPri(15);
38 + expect(ReactNoop.getChildren('a')).toEqual([span('a:2')]);
39 + expect(ReactNoop.getChildren('b')).toEqual([]);
40 + expect(ReactNoop.getChildren('c')).toEqual(null);
41 + // Then the second one gets processed
42 + ReactNoop.flushDeferredPri(15);
43 + expect(ReactNoop.getChildren('a')).toEqual([span('a:2')]);
44 + expect(ReactNoop.getChildren('b')).toEqual([span('b:2')]);
45 + expect(ReactNoop.getChildren('c')).toEqual(null);
46 +
47 + // Schedule three roots
48 + ReactNoop.renderToRootWithID(<span prop="a:3" />, 'a');
49 + ReactNoop.renderToRootWithID(<span prop="b:3" />, 'b');
50 + ReactNoop.renderToRootWithID(<span prop="c:3" />, 'c');
51 + // They get processed in the order they were scheduled
52 + ReactNoop.flushDeferredPri(15);
53 + expect(ReactNoop.getChildren('a')).toEqual([span('a:3')]);
54 + expect(ReactNoop.getChildren('b')).toEqual([span('b:2')]);
55 + expect(ReactNoop.getChildren('c')).toEqual([]);
56 + ReactNoop.flushDeferredPri(15);
57 + expect(ReactNoop.getChildren('a')).toEqual([span('a:3')]);
58 + expect(ReactNoop.getChildren('b')).toEqual([span('b:3')]);
59 + expect(ReactNoop.getChildren('c')).toEqual([]);
60 + ReactNoop.flushDeferredPri(15);
61 + expect(ReactNoop.getChildren('a')).toEqual([span('a:3')]);
62 + expect(ReactNoop.getChildren('b')).toEqual([span('b:3')]);
63 + expect(ReactNoop.getChildren('c')).toEqual([span('c:3')]);
64 +
65 + // Schedule one root many times
66 + ReactNoop.renderToRootWithID(<span prop="a:4" />, 'a');
67 + ReactNoop.renderToRootWithID(<span prop="a:5" />, 'a');
68 + ReactNoop.renderToRootWithID(<span prop="a:6" />, 'a');
69 + ReactNoop.flushDeferredPri(15);
70 + expect(ReactNoop.getChildren('a')).toEqual([span('a:6')]);
71 + });
72 +
73 + it('works on roots with animation priority before deferred work', () => {
74 + ReactNoop.renderToRootWithID(<span prop="a:1" />, 'a');
75 + ReactNoop.renderToRootWithID(<span prop="b:1" />, 'b');
76 + ReactNoop.renderToRootWithID(<span prop="c:1" />, 'c');
77 + ReactNoop.flush();
78 + expect(ReactNoop.getChildren('a')).toEqual([span('a:1')]);
79 + expect(ReactNoop.getChildren('b')).toEqual([span('b:1')]);
80 + expect(ReactNoop.getChildren('c')).toEqual([span('c:1')]);
81 +
82 + // Schedule both deferred and animation work
83 + ReactNoop.renderToRootWithID(<span prop="a:2" />, 'a');
84 + ReactNoop.performAnimationWork(() => {
85 + ReactNoop.renderToRootWithID(<span prop="b:2" />, 'b');
86 + ReactNoop.renderToRootWithID(<span prop="c:2" />, 'c');
87 + });
88 + // Handle roots with animation work first
89 + ReactNoop.flushDeferredPri(15);
90 + expect(ReactNoop.getChildren('a')).toEqual([span('a:1')]);
91 + expect(ReactNoop.getChildren('b')).toEqual([span('b:2')]);
92 + expect(ReactNoop.getChildren('c')).toEqual([span('c:1')]);
93 + ReactNoop.flushDeferredPri(15);
94 + expect(ReactNoop.getChildren('a')).toEqual([span('a:1')]);
95 + expect(ReactNoop.getChildren('b')).toEqual([span('b:2')]);
96 + expect(ReactNoop.getChildren('c')).toEqual([span('c:2')]);
97 + // Then handle deferred root
98 + ReactNoop.flushDeferredPri(15);
99 + expect(ReactNoop.getChildren('a')).toEqual([span('a:2')]);
100 + expect(ReactNoop.getChildren('b')).toEqual([span('b:2')]);
101 + expect(ReactNoop.getChildren('c')).toEqual([span('c:2')]);
102 + });
103 +});
src/renderers/shared/fiber/__tests__/ReactIncrementalSideEffects-test.js
+47 -47
@@ -46,13 +46,13 @@ describe('ReactIncrementalSideEffects', () => {
46
47 ReactNoop.render(<Foo text="Hello" />);
48 ReactNoop.flush();
49 - expect(ReactNoop.root.children).toEqual([
49 + expect(ReactNoop.getChildren()).toEqual([
50 div(span()),
51 ]);
52
53 ReactNoop.render(<Foo text="World" />);
54 ReactNoop.flush();
55 - expect(ReactNoop.root.children).toEqual([
55 + expect(ReactNoop.getChildren()).toEqual([
56 div(span(), span()),
57 ]);
58
@@ -82,19 +82,19 @@ describe('ReactIncrementalSideEffects', () => {
82
83 ReactNoop.render(<Foo text="Hello" />);
84 ReactNoop.flush();
85 - expect(ReactNoop.root.children).toEqual([
85 + expect(ReactNoop.getChildren()).toEqual([
86 div(span(), span('test')),
87 ]);
88
89 ReactNoop.render(<Foo text="World" />);
90 ReactNoop.flush();
91 - expect(ReactNoop.root.children).toEqual([
91 + expect(ReactNoop.getChildren()).toEqual([
92 div(span(), span(), div(), span('test')),
93 ]);
94
95 ReactNoop.render(<Foo text="Hi" />);
96 ReactNoop.flush();
97 - expect(ReactNoop.root.children).toEqual([
97 + expect(ReactNoop.getChildren()).toEqual([
98 div(span(), div(), span(), span('test')),
99 ]);
100
@@ -120,13 +120,13 @@ describe('ReactIncrementalSideEffects', () => {
120
121 ReactNoop.render(<Foo text="Hello" />);
122 ReactNoop.flush();
123 - expect(ReactNoop.root.children).toEqual([
123 + expect(ReactNoop.getChildren()).toEqual([
124 div('Hello'),
125 ]);
126
127 ReactNoop.render(<Foo text="World" />);
128 ReactNoop.flush();
129 - expect(ReactNoop.root.children).toEqual([
129 + expect(ReactNoop.getChildren()).toEqual([
130 div('World', 'World', '!'),
131 ]);
132
@@ -152,13 +152,13 @@ describe('ReactIncrementalSideEffects', () => {
152
153 ReactNoop.render(<Foo show={true} />);
154 ReactNoop.flush();
155 - expect(ReactNoop.root.children).toEqual([
155 + expect(ReactNoop.getChildren()).toEqual([
156 div(div(), span('Hello'), 'World'),
157 ]);
158
159 ReactNoop.render(<Foo show={false} />);
160 ReactNoop.flush();
161 - expect(ReactNoop.root.children).toEqual([
161 + expect(ReactNoop.getChildren()).toEqual([
162 div(),
163 ]);
164
@@ -199,7 +199,7 @@ describe('ReactIncrementalSideEffects', () => {
199
200 ReactNoop.render(<Foo useClass={true} />);
201 ReactNoop.flush();
202 - expect(ReactNoop.root.children).toEqual([
202 + expect(ReactNoop.getChildren()).toEqual([
203 div(span('Class'), 'Trail'),
204 ]);
205
@@ -207,7 +207,7 @@ describe('ReactIncrementalSideEffects', () => {
207
208 ReactNoop.render(<Foo useFunction={true} />);
209 ReactNoop.flush();
210 - expect(ReactNoop.root.children).toEqual([
210 + expect(ReactNoop.getChildren()).toEqual([
211 div(span('Function'), 'Trail'),
212 ]);
213
@@ -215,13 +215,13 @@ describe('ReactIncrementalSideEffects', () => {
215
216 ReactNoop.render(<Foo useText={true} />);
217 ReactNoop.flush();
218 - expect(ReactNoop.root.children).toEqual([
218 + expect(ReactNoop.getChildren()).toEqual([
219 div('Text', 'Trail'),
220 ]);
221
222 ReactNoop.render(<Foo />);
223 ReactNoop.flush();
224 - expect(ReactNoop.root.children).toEqual([
224 + expect(ReactNoop.getChildren()).toEqual([
225 div('Trail'),
226 ]);
227
@@ -260,7 +260,7 @@ describe('ReactIncrementalSideEffects', () => {
260
261 ReactNoop.render(<Foo useClass={true} />);
262 ReactNoop.flush();
263 - expect(ReactNoop.root.children).toEqual([
263 + expect(ReactNoop.getChildren()).toEqual([
264 div(span('Class'), 'Trail'),
265 ]);
266
@@ -268,7 +268,7 @@ describe('ReactIncrementalSideEffects', () => {
268
269 ReactNoop.render(<Foo useFunction={true} />);
270 ReactNoop.flush();
271 - expect(ReactNoop.root.children).toEqual([
271 + expect(ReactNoop.getChildren()).toEqual([
272 div(span('Function'), 'Trail'),
273 ]);
274
@@ -276,7 +276,7 @@ describe('ReactIncrementalSideEffects', () => {
276
277 ReactNoop.render(<Foo />);
278 ReactNoop.flush();
279 - expect(ReactNoop.root.children).toEqual([
279 + expect(ReactNoop.getChildren()).toEqual([
280 div('Trail'),
281 ]);
282
@@ -302,13 +302,13 @@ describe('ReactIncrementalSideEffects', () => {
302
303 ReactNoop.render(<Foo text="Hello" />);
304 ReactNoop.flush();
305 - expect(ReactNoop.root.children).toEqual([
305 + expect(ReactNoop.getChildren()).toEqual([
306 div(div(span('Hello'), span('Hello')), span('Yo')),
307 ]);
308
309 ReactNoop.render(<Foo text="World" />);
310 ReactNoop.flushDeferredPri(35);
311 - expect(ReactNoop.root.children).toEqual([
311 + expect(ReactNoop.getChildren()).toEqual([
312 div(div(span('Hello'), span('Hello')), span('Yo')),
313 ]);
314
@@ -333,20 +333,20 @@ describe('ReactIncrementalSideEffects', () => {
333 ReactNoop.render(<Foo text="foo" />);
334 ReactNoop.flush();
335
336 - expect(ReactNoop.root.children).toEqual([
336 + expect(ReactNoop.getChildren()).toEqual([
337 div(div(span('foo'))),
338 ]);
339
340 ReactNoop.render(<Foo text="bar" />);
341 ReactNoop.flushDeferredPri(20);
342
343 - expect(ReactNoop.root.children).toEqual([
343 + expect(ReactNoop.getChildren()).toEqual([
344 div(div(span('foo'))),
345 ]);
346
347 ReactNoop.flush();
348
349 - expect(ReactNoop.root.children).toEqual([
349 + expect(ReactNoop.getChildren()).toEqual([
350 div(div(span('bar'))),
351 ]);
352
@@ -384,7 +384,7 @@ describe('ReactIncrementalSideEffects', () => {
384 ReactNoop.render(<Foo text="foo" step={0} />);
385 ReactNoop.flush();
386
387 - expect(ReactNoop.root.children).toEqual([
387 + expect(ReactNoop.getChildren()).toEqual([
388 div(div(span('Hi'), span('foo'))),
389 ]);
390
@@ -394,7 +394,7 @@ describe('ReactIncrementalSideEffects', () => {
394 ReactNoop.flushDeferredPri(30);
395
396 // The tree remains unchanged.
397 - expect(ReactNoop.root.children).toEqual([
397 + expect(ReactNoop.getChildren()).toEqual([
398 div(div(span('Hi'), span('foo'))),
399 ]);
400
@@ -408,7 +408,7 @@ describe('ReactIncrementalSideEffects', () => {
408 // we should be able to reuse the reconciliation work that we already did
409 // without restarting. The side-effects should still be replayed.
410
411 - expect(ReactNoop.root.children).toEqual([
411 + expect(ReactNoop.getChildren()).toEqual([
412 div(div(span('Hello'), span('World'))),
413 ]);
414 });
@@ -450,7 +450,7 @@ describe('ReactIncrementalSideEffects', () => {
450 ReactNoop.render(<Foo text="foo" step={0} />);
451 ReactNoop.flush();
452
453 - expect(ReactNoop.root.children).toEqual([
453 + expect(ReactNoop.getChildren()).toEqual([
454 div(div(span('Hi'), span('foo'))),
455 ]);
456
@@ -460,7 +460,7 @@ describe('ReactIncrementalSideEffects', () => {
460 ReactNoop.flushDeferredPri(35);
461
462 // The tree remains unchanged.
463 - expect(ReactNoop.root.children).toEqual([
463 + expect(ReactNoop.getChildren()).toEqual([
464 div(div(span('Hi'), span('foo'))),
465 ]);
466
@@ -474,7 +474,7 @@ describe('ReactIncrementalSideEffects', () => {
474 // we should be able to reuse the reconciliation work that we already did
475 // without restarting. The side-effects should still be replayed.
476
477 - expect(ReactNoop.root.children).toEqual([
477 + expect(ReactNoop.getChildren()).toEqual([
478 div(div(span('Hello'), span('World'))),
479 ]);
480 });
@@ -490,7 +490,7 @@ describe('ReactIncrementalSideEffects', () => {
490
491 ReactNoop.render(<Foo />);
492 ReactNoop.flush();
493 - expect(ReactNoop.root.children).toEqual([
493 + expect(ReactNoop.getChildren()).toEqual([
494 div(span(1)),
495 ]);
496 });
@@ -517,7 +517,7 @@ describe('ReactIncrementalSideEffects', () => {
517 }
518 ReactNoop.render(<Foo tick={0} idx={0} />);
519 ReactNoop.flushDeferredPri(40 + 25);
520 - expect(ReactNoop.root.children).toEqual([
520 + expect(ReactNoop.getChildren()).toEqual([
521 div(
522 span(0),
523 div(/*the spans are down-prioritized and not rendered yet*/)
@@ -525,14 +525,14 @@ describe('ReactIncrementalSideEffects', () => {
525 ]);
526 ReactNoop.render(<Foo tick={1} idx={0} />);
527 ReactNoop.flushDeferredPri(35 + 25);
528 - expect(ReactNoop.root.children).toEqual([
528 + expect(ReactNoop.getChildren()).toEqual([
529 div(
530 span(1),
531 div(/*still not rendered yet*/)
532 ),
533 ]);
534 ReactNoop.flushDeferredPri(30 + 25);
535 - expect(ReactNoop.root.children).toEqual([
535 + expect(ReactNoop.getChildren()).toEqual([
536 div(
537 span(1),
538 div(
@@ -542,10 +542,10 @@ describe('ReactIncrementalSideEffects', () => {
542 )
543 ),
544 ]);
545 - var innerSpanA = ReactNoop.root.children[0].children[1].children[1];
545 + var innerSpanA = ReactNoop.getChildren()[0].children[1].children[1];
546 ReactNoop.render(<Foo tick={2} idx={1} />);
547 ReactNoop.flushDeferredPri(30 + 25);
548 - expect(ReactNoop.root.children).toEqual([
548 + expect(ReactNoop.getChildren()).toEqual([
549 div(
550 span(2),
551 div(
@@ -557,7 +557,7 @@ describe('ReactIncrementalSideEffects', () => {
557 ]);
558 ReactNoop.render(<Foo tick={3} idx={1} />);
559 ReactNoop.flush();
560 - expect(ReactNoop.root.children).toEqual([
560 + expect(ReactNoop.getChildren()).toEqual([
561 div(
562 span(3),
563 div(
@@ -568,7 +568,7 @@ describe('ReactIncrementalSideEffects', () => {
568 ),
569 ]);
570
571 - var innerSpanB = ReactNoop.root.children[0].children[1].children[1];
571 + var innerSpanB = ReactNoop.getChildren()[0].children[1].children[1];
572 // This should have been an update to an existing instance, not recreation.
573 // We verify that by ensuring that the child instance was the same as
574 // before.
@@ -611,7 +611,7 @@ describe('ReactIncrementalSideEffects', () => {
611 }
612 ReactNoop.render(<Foo tick={0} idx={0} />);
613 ReactNoop.flushDeferredPri(65);
614 - expect(ReactNoop.root.children).toEqual([
614 + expect(ReactNoop.getChildren()).toEqual([
615 div(
616 span(0),
617 div(/*the spans are down-prioritized and not rendered yet*/)
@@ -623,7 +623,7 @@ describe('ReactIncrementalSideEffects', () => {
623
624 ReactNoop.render(<Foo tick={1} idx={0} />);
625 ReactNoop.flushDeferredPri(70);
626 - expect(ReactNoop.root.children).toEqual([
626 + expect(ReactNoop.getChildren()).toEqual([
627 div(
628 span(1),
629 div(/*still not rendered yet*/)
@@ -634,7 +634,7 @@ describe('ReactIncrementalSideEffects', () => {
634 ops = [];
635
636 ReactNoop.flush();
637 - expect(ReactNoop.root.children).toEqual([
637 + expect(ReactNoop.getChildren()).toEqual([
638 div(
639 span(1),
640 div(
@@ -656,7 +656,7 @@ describe('ReactIncrementalSideEffects', () => {
656 // way through.
657 ReactNoop.render(<Foo tick={2} idx={1} />);
658 ReactNoop.flushDeferredPri(95);
659 - expect(ReactNoop.root.children).toEqual([
659 + expect(ReactNoop.getChildren()).toEqual([
660 div(
661 span(2),
662 div(
@@ -680,7 +680,7 @@ describe('ReactIncrementalSideEffects', () => {
680 // way through.
681 ReactNoop.render(<Foo tick={3} idx={1} />);
682 ReactNoop.flushDeferredPri(50);
683 - expect(ReactNoop.root.children).toEqual([
683 + expect(ReactNoop.getChildren()).toEqual([
684 div(
685 span(3),
686 div(
@@ -701,7 +701,7 @@ describe('ReactIncrementalSideEffects', () => {
701 // We should now be able to reuse some of the work we've already done
702 // and replay those side-effects.
703 ReactNoop.flush();
704 - expect(ReactNoop.root.children).toEqual([
704 + expect(ReactNoop.getChildren()).toEqual([
705 div(
706 span(3),
707 div(
@@ -753,7 +753,7 @@ describe('ReactIncrementalSideEffects', () => {
753 }
754 ReactNoop.render(<Foo tick={0} idx={0} />);
755 ReactNoop.flush();
756 - expect(ReactNoop.root.children).toEqual([
756 + expect(ReactNoop.getChildren()).toEqual([
757 div(
758 span(0),
759 div(
@@ -770,7 +770,7 @@ describe('ReactIncrementalSideEffects', () => {
770
771 ReactNoop.render(<Foo tick={1} idx={1} />);
772 ReactNoop.flushDeferredPri(70);
773 - expect(ReactNoop.root.children).toEqual([
773 + expect(ReactNoop.getChildren()).toEqual([
774 div(
775 // Updated.
776 span(1),
@@ -793,7 +793,7 @@ describe('ReactIncrementalSideEffects', () => {
793 // TODO: The cycles it takes to do this could be lowered with further
794 // optimizations.
795 ReactNoop.flushDeferredPri(60);
796 - expect(ReactNoop.root.children).toEqual([
796 + expect(ReactNoop.getChildren()).toEqual([
797 div(
798 // Updated.
799 span(1),
@@ -812,7 +812,7 @@ describe('ReactIncrementalSideEffects', () => {
812 // However, once we render fully, we will have enough time to finish it all
813 // at once.
814 ReactNoop.flush();
815 - expect(ReactNoop.root.children).toEqual([
815 + expect(ReactNoop.getChildren()).toEqual([
816 div(
817 span(1),
818 div(
@@ -845,12 +845,12 @@ describe('ReactIncrementalSideEffects', () => {
845
846 ReactNoop.render(<Foo />);
847 ReactNoop.flush();
848 - expect(ReactNoop.root.children).toEqual([
848 + expect(ReactNoop.getChildren()).toEqual([
849 span('foo'),
850 ]);
851 let called = false;
852 instance.setState({ text: 'bar' }, () => {
853 - expect(ReactNoop.root.children).toEqual([
853 + expect(ReactNoop.getChildren()).toEqual([
854 span('bar'),
855 ]);
856 called = true;
src/renderers/shared/fiber/__tests__/ReactTopLevelText-test.js
+2 -2
@@ -26,14 +26,14 @@ describe('ReactTopLevelText', () => {
26 const Text = ({value}) => value;
27 ReactNoop.render(<Text value="foo" />);
28 ReactNoop.flush();
29 - expect(ReactNoop.root.children).toEqual([{text: 'foo'}]);
29 + expect(ReactNoop.getChildren()).toEqual([{text: 'foo'}]);
30 });
31
32 it('should render a component returning numbers directly from render', () => {
33 const Text = ({value}) => value;
34 ReactNoop.render(<Text value={10} />);
35 ReactNoop.flush();
36 - expect(ReactNoop.root.children).toEqual([{text: '10'}]);
36 + expect(ReactNoop.getChildren()).toEqual([{text: '10'}]);
37 });
38
39 });