Only add children when there are children

This commit is contained in:
Josh Perez
2016-01-16 21:21:08 -08:00
parent 2f792d5a60
commit 3da6e2889b
2 changed files with 12 additions and 1 deletions
@@ -85,7 +85,10 @@ var ReactDOMOption = {
}
});
nativeProps.children = content;
if (content) {
nativeProps.children = content;
}
return nativeProps;
},
@@ -63,4 +63,12 @@ describe('ReactDOMOption', function() {
expect(console.error.calls.length).toBe(0);
expect(node.innerHTML).toBe('1 2');
});
it('should be able to use dangerouslySetInnerHTML on option', function() {
var stub = <option dangerouslySetInnerHTML={{ __html: 'foobar' }} />;
stub = ReactTestUtils.renderIntoDocument(stub);
var node = ReactDOM.findDOMNode(stub);
expect(node.innerHTML).toBe('foobar');
});
});