Skip to content

Commit

Permalink
Add a regression test for #11602
Browse files Browse the repository at this point in the history
  • Loading branch information
gaearon committed Aug 2, 2018
1 parent 470377b commit 5e8beec
Showing 1 changed file with 25 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -414,20 +414,35 @@ describe('ReactDOMServerIntegration', () => {
},
);

itRenders('an option with flattened children', async render => {
itRenders('a select option with flattened children', async render => {
const e = await render(
<select readOnly={true} value="bar">
<option value="bar">
{['Bar', false, 'Foo', <div key="1" />, 'Baz']}
</option>
<select value="bar" readOnly={true}>
<option value="bar">A {'B'}</option>
</select>,
1,
);
expect(e.getAttribute('value')).toBe(null);
expect(e.getAttribute('defaultValue')).toBe(null);
expect(e.firstChild.innerHTML).toBe('BarFooBaz');
expect(e.firstChild.selected).toBe(true);
const option = e.options[0];
expect(option.childNodes.length).toBe(1);
expect(option.childNodes[0].nodeType).toBe(3);
expect(option.childNodes[0].nodeValue).toBe('A B');
});

itRenders(
'a select option with flattened children and a warning',
async render => {
const e = await render(
<select readOnly={true} value="bar">
<option value="bar">
{['Bar', false, 'Foo', <div key="1" />, 'Baz']}
</option>
</select>,
1,
);
expect(e.getAttribute('value')).toBe(null);
expect(e.getAttribute('defaultValue')).toBe(null);
expect(e.firstChild.innerHTML).toBe('BarFooBaz');
expect(e.firstChild.selected).toBe(true);
},
);
});

describe('user interaction', function() {
Expand Down

0 comments on commit 5e8beec

Please sign in to comment.