File tree 2 files changed +13
-1
lines changed
2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change
1
+ // this is where we'll put bug reproductions/regressions
2
+ // to make sure we never see them again
3
+
4
+ import React from 'react'
5
+ import { render , cleanup } from '../'
6
+
7
+ test ( 'cleanup does not error when an element is not a child' , ( ) => {
8
+ render ( < div /> , { container : document . createElement ( 'div' ) } )
9
+ cleanup ( )
10
+ } )
Original file line number Diff line number Diff line change @@ -37,7 +37,9 @@ function cleanup() {
37
37
// maybe one day we'll expose this (perhaps even as a utility returned by render).
38
38
// but let's wait until someone asks for it.
39
39
function cleanupAtContainer ( container ) {
40
- document . body . removeChild ( container )
40
+ if ( container . parentNode === document . body ) {
41
+ document . body . removeChild ( container )
42
+ }
41
43
ReactDOM . unmountComponentAtNode ( container )
42
44
mountedContainers . delete ( container )
43
45
}
You can’t perform that action at this time.
0 commit comments