@samitouri / QOS-React / commits / a43ba2625b

Add an extra test for arrays and strings from composites (#10346)

Dan Abramov committed Aug 2, 2017 at 01:05 UTC a43ba2625b8ba170b4e30ce7c4e5cf1975ff5b88
1 file changed +28
src/renderers/dom/shared/__tests__/ReactDOMServerIntegration-test.js
+28
@@ -1391,6 +1391,34 @@ describe('ReactDOMServerIntegration', () => {
1391 expectTextNode(textNode2, ' ');
1392 },
1393 );
1394 +
1395 + if (ReactDOMFeatureFlags.useFiber) {
1396 + itRenders('a composite with multiple children', async render => {
1397 + const Component = props => props.children;
1398 + const e = await render(
1399 + <Component>{['a', 'b', [undefined], [[false, 'c']]]}</Component>,
1400 + );
1401 +
1402 + let parent = e.parentNode;
1403 + if (
1404 + render === serverRender ||
1405 + render === clientRenderOnServerString ||
1406 + render === streamRender
1407 + ) {
1408 + // For plain server markup result we have comments between.
1409 + // If we're able to hydrate, they remain.
1410 + expect(parent.childNodes.length).toBe(5);
1411 + expectTextNode(parent.childNodes[0], 'a');
1412 + expectTextNode(parent.childNodes[2], 'b');
1413 + expectTextNode(parent.childNodes[4], 'c');
1414 + } else {
1415 + expect(parent.childNodes.length).toBe(3);
1416 + expectTextNode(parent.childNodes[0], 'a');
1417 + expectTextNode(parent.childNodes[1], 'b');
1418 + expectTextNode(parent.childNodes[2], 'c');
1419 + }
1420 + });
1421 + }
1422 });
1423
1424 describe('escaping >, <, and &', function() {