diff --git a/src/modal/modal.js b/src/modal/modal.js index 106b988a71..a6cafcce75 100644 --- a/src/modal/modal.js +++ b/src/modal/modal.js @@ -272,7 +272,7 @@ angular.module('ui.bootstrap.modal', []) openedWindows.remove(modalInstance); removeAfterAnimate(modalWindow.modalDomEl, modalWindow.modalScope, function() { - body.toggleClass(modalInstance.openedClass || OPENED_MODAL_CLASS, openedWindows.length() > 0); + body.toggleClass(modalWindow.openedClass || OPENED_MODAL_CLASS, openedWindows.length() > 0); }); checkRemoveBackdrop(); diff --git a/src/modal/test/modal.spec.js b/src/modal/test/modal.spec.js index 2be1b7c969..0b6abb8640 100644 --- a/src/modal/test/modal.spec.js +++ b/src/modal/test/modal.spec.js @@ -768,13 +768,18 @@ describe('$modal', function () { }); describe('openedClass', function () { + var body; + + beforeEach(function() { + body = $document.find('body'); + }); it('should add the modal-open class to the body element by default', function () { open({ template: '