mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
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:
@@ -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();
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user