File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed
packages/react-dom/src/__tests__ Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -377,6 +377,26 @@ describe('ReactDOM', () => {
377
377
}
378
378
} ) ;
379
379
380
+ it ( 'should not crash calling findDOMNode inside a functional component' , ( ) => {
381
+ const container = document . createElement ( 'div' ) ;
382
+
383
+ class Component extends React . Component {
384
+ render ( ) {
385
+ return < div /> ;
386
+ }
387
+ }
388
+
389
+ const instance = ReactTestUtils . renderIntoDocument ( < Component /> ) ;
390
+ const App = ( ) => {
391
+ ReactDOM . findDOMNode ( instance ) ;
392
+ return < div /> ;
393
+ } ;
394
+
395
+ if ( __DEV__ ) {
396
+ ReactDOM . render ( < App /> , container ) ;
397
+ }
398
+ } ) ;
399
+
380
400
it ( 'throws in DEV if jsdom is destroyed by the time setState() is called' , ( ) => {
381
401
class App extends React . Component {
382
402
state = { x : 1 } ;
You can’t perform that action at this time.
0 commit comments