This repository was archived by the owner on May 29, 2019. It is now read-only.
File tree 2 files changed +20
-4
lines changed
2 files changed +20
-4
lines changed Original file line number Diff line number Diff line change @@ -272,7 +272,7 @@ angular.module('ui.bootstrap.modal', [])
272
272
openedWindows . remove ( modalInstance ) ;
273
273
274
274
removeAfterAnimate ( modalWindow . modalDomEl , modalWindow . modalScope , function ( ) {
275
- body . toggleClass ( modalInstance . openedClass || OPENED_MODAL_CLASS , openedWindows . length ( ) > 0 ) ;
275
+ body . toggleClass ( modalWindow . openedClass || OPENED_MODAL_CLASS , openedWindows . length ( ) > 0 ) ;
276
276
} ) ;
277
277
checkRemoveBackdrop ( ) ;
278
278
Original file line number Diff line number Diff line change @@ -768,13 +768,18 @@ describe('$modal', function () {
768
768
} ) ;
769
769
770
770
describe ( 'openedClass' , function ( ) {
771
+ var body ;
772
+
773
+ beforeEach ( function ( ) {
774
+ body = $document . find ( 'body' ) ;
775
+ } ) ;
771
776
772
777
it ( 'should add the modal-open class to the body element by default' , function ( ) {
773
778
open ( {
774
779
template : '<div>dummy modal</div>'
775
780
} ) ;
776
781
777
- expect ( $document . find ( ' body' ) ) . toHaveClass ( 'modal-open' ) ;
782
+ expect ( body ) . toHaveClass ( 'modal-open' ) ;
778
783
} ) ;
779
784
780
785
it ( 'should add the custom class to the body element' , function ( ) {
@@ -783,11 +788,22 @@ describe('$modal', function () {
783
788
openedClass : 'foo'
784
789
} ) ;
785
790
786
- var body = $document . find ( 'body' ) ;
787
-
788
791
expect ( body ) . toHaveClass ( 'foo' ) ;
789
792
expect ( body ) . not . toHaveClass ( 'modal-open' ) ;
790
793
} ) ;
794
+
795
+ it ( 'should remove the custom class on closing of modal' , function ( ) {
796
+ var modal = open ( {
797
+ template : '<div>dummy modal</div>' ,
798
+ openedClass : 'foo'
799
+ } ) ;
800
+
801
+ expect ( body ) . toHaveClass ( 'foo' ) ;
802
+
803
+ close ( modal ) ;
804
+
805
+ expect ( body ) . not . toHaveClass ( 'foo' ) ;
806
+ } ) ;
791
807
} ) ;
792
808
793
809
} ) ;
You can’t perform that action at this time.
0 commit comments