Skip to content

Commit

Permalink
Add test for multiple text nodes in an option tag
Browse files Browse the repository at this point in the history
  • Loading branch information
jorrit committed Nov 22, 2017
1 parent 7e71273 commit cd905f1
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions packages/react-dom/src/__tests__/ReactDOMServerIntegration-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1304,6 +1304,38 @@ describe('ReactDOMServerIntegration', () => {
expectTextNode(e.childNodes[3], 'e');
}
});

itRenders(
'a select with value containing an option with multiple text children',
async render => {
const e = await render(
<select value="bar" readOnly={true}>
<option value="bar">A{'B'}</option>
</select>,
0,
);

const option = e.childNodes[0];

if (render === serverRender || render === streamRender) {
// We have three nodes because there is a comment between them.
expect(option.childNodes.length).toBe(3);
// Everything becomes LF when parsed from server HTML.
// Null character is ignored.
expectNode(option.childNodes[0], TEXT_NODE_TYPE, 'A');
expectNode(option.childNodes[2], TEXT_NODE_TYPE, 'B');
} else if (render === clientRenderOnServerString) {
// We have three nodes because there is a comment between them.
expect(option.childNodes.length).toBe(3);
expectNode(option.childNodes[0], TEXT_NODE_TYPE, 'A');
expectNode(option.childNodes[2], TEXT_NODE_TYPE, 'B');
} else {
expect(option.childNodes.length).toBe(2);
expectNode(option.childNodes[0], TEXT_NODE_TYPE, 'A');
expectNode(option.childNodes[1], TEXT_NODE_TYPE, 'B');
}
},
);
});

describe('number children', function() {
Expand Down

0 comments on commit cd905f1

Please sign in to comment.