@samitouri / QOS-React-2 / commits / 5e8beec84b

Add a regression test for #11602

Dan Abramov committed Aug 2, 2018 at 02:46 UTC 5e8beec84b83d6f1836071b5c187fbd95a839b96
1 file changed +25 -10
packages/react-dom/src/__tests__/ReactDOMServerIntegrationForms-test.js
+25 -10
@@ -414,20 +414,35 @@ describe('ReactDOMServerIntegration', () => {
414 },
415 );
416
417 - itRenders('an option with flattened children', async render => {
417 + itRenders('a select option with flattened children', async render => {
418 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>
421 </select>,
424 - 1,
422 );
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');
427 });
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 + );
446 });
447
448 describe('user interaction', function() {