Skip to content
This repository has been archived by the owner on May 29, 2019. It is now read-only.

Commit

Permalink
fix(modal): correctly close modals with no backdrop
Browse files Browse the repository at this point in the history
backdropDomEl was not initialised if only modal without backdrop was opened.

Closes #974
Closes #979
  • Loading branch information
pkozlowski-opensource committed Sep 10, 2013
1 parent 08d8b21 commit e55c2de
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/modal/modal.js
Expand Up @@ -136,7 +136,7 @@ angular.module('ui.bootstrap.modal', [])
modalWindow.modalDomEl.remove();

//remove backdrop if no longer needed
if (backdropIndex() == -1) {
if (backdropDomEl && backdropIndex() == -1) {
backdropDomEl.remove();
backdropDomEl = undefined;
}
Expand Down Expand Up @@ -312,4 +312,4 @@ angular.module('ui.bootstrap.modal', [])
};

return $modalProvider;
});
});
5 changes: 4 additions & 1 deletion src/modal/test/modal.spec.js
Expand Up @@ -351,12 +351,15 @@ describe('$modal', function () {
describe('backdrop', function () {

it('should not have any backdrop element if backdrop set to false', function () {
open({
var modal =open({
template: '<div>No backdrop</div>',
backdrop: false
});
expect($document).toHaveModalOpenWithContent('No backdrop', 'div');
expect($document).not.toHaveBackdrop();

dismiss(modal);
expect($document).toHaveModalsOpen(0);
});

it('should not close modal on backdrop click if backdrop is specified as "static"', function () {
Expand Down

0 comments on commit e55c2de

Please sign in to comment.