File tree Expand file tree Collapse file tree 2 files changed +8
-0
lines changed Expand file tree Collapse file tree 2 files changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -54,6 +54,7 @@ var Modal = module.exports = React.createClass({
54
54
componentWillUnmount : function ( ) {
55
55
ReactDOM . unmountComponentAtNode ( this . node ) ;
56
56
document . body . removeChild ( this . node ) ;
57
+ elementClass ( document . body ) . remove ( 'ReactModal__Body--open' ) ;
57
58
} ,
58
59
59
60
renderPortal : function ( props ) {
Original file line number Diff line number Diff line change @@ -136,6 +136,13 @@ describe('Modal', function () {
136
136
unmountModal ( ) ;
137
137
} ) ;
138
138
139
+ it ( 'removes class from body when unmounted without closing' , function ( ) {
140
+ modal = renderModal ( { isOpen : true } ) ;
141
+ equal ( document . body . className . indexOf ( 'ReactModal__Body--open' ) !== - 1 , true ) ;
142
+ unmountModal ( ) ;
143
+ equal ( document . body . className . indexOf ( 'ReactModal__Body--open' ) !== - 1 , false ) ;
144
+ } ) ;
145
+
139
146
it ( 'adds --after-open for animations' , function ( ) {
140
147
var modal = renderModal ( { isOpen : true } ) ;
141
148
var overlay = document . querySelector ( '.ReactModal__Overlay' ) ;
You can’t perform that action at this time.
0 commit comments