mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
tests: add regression test for reading ReactCurrentOwner stateNode (#12412)
* tests: add regression test for reading ReactCurrentOwner stateNode * tests: replace expect with just rendering the component
This commit is contained in:
committed by
Dan Abramov
parent
1591c8ebab
commit
a4cef29703
@@ -377,6 +377,26 @@ describe('ReactDOM', () => {
|
||||
}
|
||||
});
|
||||
|
||||
it('should not crash calling findDOMNode inside a functional component', () => {
|
||||
const container = document.createElement('div');
|
||||
|
||||
class Component extends React.Component {
|
||||
render() {
|
||||
return <div />;
|
||||
}
|
||||
}
|
||||
|
||||
const instance = ReactTestUtils.renderIntoDocument(<Component />);
|
||||
const App = () => {
|
||||
ReactDOM.findDOMNode(instance);
|
||||
return <div />;
|
||||
};
|
||||
|
||||
if (__DEV__) {
|
||||
ReactDOM.render(<App />, container);
|
||||
}
|
||||
});
|
||||
|
||||
it('throws in DEV if jsdom is destroyed by the time setState() is called', () => {
|
||||
class App extends React.Component {
|
||||
state = {x: 1};
|
||||
|
||||
Reference in New Issue
Block a user