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

fix(modal): fix race condition with openedClass #5483

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/modal/modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,9 @@ angular.module('ui.bootstrap.modal', ['ui.bootstrap.stackedMap'])

$animate.enter($compile(angularDomEl)(modal.scope), appendToElement)
.then(function() {
$animate.addClass(appendToElement, modalBodyClass);
if (!modal.scope.$$uibDestructionScheduled) {
$animate.addClass(appendToElement, modalBodyClass);
}
});

openedWindows.top().value.modalDomEl = angularDomEl;
Expand Down
10 changes: 10 additions & 0 deletions src/modal/test/modal.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1219,6 +1219,16 @@ describe('$uibModal', function() {
expect(body).not.toHaveClass('bar');
expect(body).not.toHaveClass('modal-open');
});

it('should not add the modal-open class if modal is closed before animation', function() {
var modal = open({
template: '<div>dummy modal</div>'
}, true);

close(modal);

expect(body).not.toHaveClass('modal-open');
});
});
});

Expand Down