Skip to content

Commit 5e8beec

Browse files
committed
Add a regression test for facebook#11602
1 parent 470377b commit 5e8beec

1 file changed

Lines changed: 25 additions & 10 deletions

File tree

packages/react-dom/src/__tests__/ReactDOMServerIntegrationForms-test.js

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -414,20 +414,35 @@ describe('ReactDOMServerIntegration', () => {
414414
},
415415
);
416416

417-
itRenders('an option with flattened children', async render => {
417+
itRenders('a select option with flattened children', async render => {
418418
const e = await render(
419-
<select readOnly={true} value="bar">
420-
<option value="bar">
421-
{['Bar', false, 'Foo', <div key="1" />, 'Baz']}
422-
</option>
419+
<select value="bar" readOnly={true}>
420+
<option value="bar">A {'B'}</option>
423421
</select>,
424-
1,
425422
);
426-
expect(e.getAttribute('value')).toBe(null);
427-
expect(e.getAttribute('defaultValue')).toBe(null);
428-
expect(e.firstChild.innerHTML).toBe('BarFooBaz');
429-
expect(e.firstChild.selected).toBe(true);
423+
const option = e.options[0];
424+
expect(option.childNodes.length).toBe(1);
425+
expect(option.childNodes[0].nodeType).toBe(3);
426+
expect(option.childNodes[0].nodeValue).toBe('A B');
430427
});
428+
429+
itRenders(
430+
'a select option with flattened children and a warning',
431+
async render => {
432+
const e = await render(
433+
<select readOnly={true} value="bar">
434+
<option value="bar">
435+
{['Bar', false, 'Foo', <div key="1" />, 'Baz']}
436+
</option>
437+
</select>,
438+
1,
439+
);
440+
expect(e.getAttribute('value')).toBe(null);
441+
expect(e.getAttribute('defaultValue')).toBe(null);
442+
expect(e.firstChild.innerHTML).toBe('BarFooBaz');
443+
expect(e.firstChild.selected).toBe(true);
444+
},
445+
);
431446
});
432447

433448
describe('user interaction', function() {

0 commit comments

Comments
 (0)