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 Jan 6, 2018
1 parent 48833f6 commit 6c3274d
Showing 1 changed file with 32 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -871,5 +871,37 @@ describe('ReactDOMServerIntegration', () => {
: ''),
);
});

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');
}
},
);
});
});

0 comments on commit 6c3274d

Please sign in to comment.