mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Add an extra test for arrays and strings from composites (#10346)
This commit is contained in:
@@ -1391,6 +1391,34 @@ describe('ReactDOMServerIntegration', () => {
|
||||
expectTextNode(textNode2, ' ');
|
||||
},
|
||||
);
|
||||
|
||||
if (ReactDOMFeatureFlags.useFiber) {
|
||||
itRenders('a composite with multiple children', async render => {
|
||||
const Component = props => props.children;
|
||||
const e = await render(
|
||||
<Component>{['a', 'b', [undefined], [[false, 'c']]]}</Component>,
|
||||
);
|
||||
|
||||
let parent = e.parentNode;
|
||||
if (
|
||||
render === serverRender ||
|
||||
render === clientRenderOnServerString ||
|
||||
render === streamRender
|
||||
) {
|
||||
// For plain server markup result we have comments between.
|
||||
// If we're able to hydrate, they remain.
|
||||
expect(parent.childNodes.length).toBe(5);
|
||||
expectTextNode(parent.childNodes[0], 'a');
|
||||
expectTextNode(parent.childNodes[2], 'b');
|
||||
expectTextNode(parent.childNodes[4], 'c');
|
||||
} else {
|
||||
expect(parent.childNodes.length).toBe(3);
|
||||
expectTextNode(parent.childNodes[0], 'a');
|
||||
expectTextNode(parent.childNodes[1], 'b');
|
||||
expectTextNode(parent.childNodes[2], 'c');
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
describe('escaping >, <, and &', function() {
|
||||
|
||||
Reference in New Issue
Block a user