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 @@ -59,6 +59,7 @@ var Modal = module.exports = React.createClass({
5959 componentWillUnmount : function ( ) {
6060 ReactDOM . unmountComponentAtNode ( this . node ) ;
6161 AppElement . removeChild ( this . node ) ;
62+ elementClass ( document . body ) . remove ( 'ReactModal__Body--open' ) ;
6263 } ,
6364
6465 renderPortal : function ( props ) {
Original file line number Diff line number Diff line change @@ -175,6 +175,13 @@ describe('Modal', function () {
175175 unmountModal ( ) ;
176176 } ) ;
177177
178+ it ( 'removes class from body when unmounted without closing' , function ( ) {
179+ var modal = renderModal ( { isOpen : true } ) ;
180+ equal ( document . body . className . indexOf ( 'ReactModal__Body--open' ) !== - 1 , true ) ;
181+ unmountModal ( ) ;
182+ equal ( document . body . className . indexOf ( 'ReactModal__Body--open' ) !== - 1 , false ) ;
183+ } ) ;
184+
178185 it ( 'adds --after-open for animations' , function ( ) {
179186 var modal = renderModal ( { isOpen : true } ) ;
180187 var overlay = document . querySelector ( '.ReactModal__Overlay' ) ;
You can’t perform that action at this time.
0 commit comments