Skip to content

Commit

Permalink
test(modal): Add test for double close/dismiss fix #260
Browse files Browse the repository at this point in the history
  • Loading branch information
jbrowning committed Oct 13, 2015
1 parent 24e4737 commit 33067ae
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions src/modal/test/modal.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,37 @@ describe('$modal', function () {
expect($document).not.toHaveBackdrop();
});

it('should not throw an exception on a second dismiss', function () {
var modal = open({template: '<div>Content</div>'});

expect($document).toHaveModalsOpen(1);
expect($document).toHaveModalOpenWithContent('Content', 'div');
expect($document).toHaveBackdrop();

dismiss(modal, 'closing in test');

expect($document).toHaveModalsOpen(0);

dismiss(modal, 'closing in test');
});

it('should not throw an exception on a second close', function () {

var modal = open({template: '<div>Content</div>'});

expect($document).toHaveModalsOpen(1);
expect($document).toHaveModalOpenWithContent('Content', 'div');
expect($document).toHaveBackdrop();

modal.close('closing in test');
$timeout.flush();
$rootScope.$digest();

expect($document).toHaveModalsOpen(0);

modal.close('closing in test');
});

it('should open a modal from templateUrl', function () {

$templateCache.put('content.html', '<div>URL Content</div>');
Expand Down

0 comments on commit 33067ae

Please sign in to comment.