Merge pull request #6305 from maherbeg/maher-error-find-dom-node

Test to verify findDOMNode does not throw in willMount
This commit is contained in:
Jim
2016-03-24 18:59:55 -07:00
@@ -58,4 +58,17 @@ describe('findDOMNode', function() {
);
});
it('findDOMNode should not throw an error when called within a component that is not mounted', function() {
var Bar = React.createClass({
componentWillMount: function() {
expect(ReactDOM.findDOMNode(this)).toBeNull();
},
render: function() {
return <div/>;
},
});
expect(() => ReactTestUtils.renderIntoDocument(<Bar/>)).not.toThrow();
});
});