File tree 1 file changed +31
-0
lines changed
1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -188,6 +188,37 @@ describe('$modal', function () {
188
188
expect ( $document ) . not . toHaveBackdrop ( ) ;
189
189
} ) ;
190
190
191
+ it ( 'should not throw an exception on a second dismiss' , function ( ) {
192
+ var modal = open ( { template : '<div>Content</div>' } ) ;
193
+
194
+ expect ( $document ) . toHaveModalsOpen ( 1 ) ;
195
+ expect ( $document ) . toHaveModalOpenWithContent ( 'Content' , 'div' ) ;
196
+ expect ( $document ) . toHaveBackdrop ( ) ;
197
+
198
+ dismiss ( modal , 'closing in test' ) ;
199
+
200
+ expect ( $document ) . toHaveModalsOpen ( 0 ) ;
201
+
202
+ dismiss ( modal , 'closing in test' ) ;
203
+ } ) ;
204
+
205
+ it ( 'should not throw an exception on a second close' , function ( ) {
206
+
207
+ var modal = open ( { template : '<div>Content</div>' } ) ;
208
+
209
+ expect ( $document ) . toHaveModalsOpen ( 1 ) ;
210
+ expect ( $document ) . toHaveModalOpenWithContent ( 'Content' , 'div' ) ;
211
+ expect ( $document ) . toHaveBackdrop ( ) ;
212
+
213
+ modal . close ( 'closing in test' ) ;
214
+ $timeout . flush ( ) ;
215
+ $rootScope . $digest ( ) ;
216
+
217
+ expect ( $document ) . toHaveModalsOpen ( 0 ) ;
218
+
219
+ modal . close ( 'closing in test' ) ;
220
+ } ) ;
221
+
191
222
it ( 'should open a modal from templateUrl' , function ( ) {
192
223
193
224
$templateCache . put ( 'content.html' , '<div>URL Content</div>' ) ;
You can’t perform that action at this time.
0 commit comments