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

Commit 409b7aa

Browse files
Anthony Cleaverwesleycho
Anthony Cleaver
authored andcommitted
fix(modal): remove window class after animation
- Wait until animations are complete before removing window class BREAKING CHANGE: This introduces a minor behavior change in when the class is removed Closes #6056 Fixes #6051
1 parent ed3400b commit 409b7aa

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

src/modal/modal.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -375,16 +375,17 @@ angular.module('ui.bootstrap.modal', ['ui.bootstrap.stackedMap', 'ui.bootstrap.p
375375
afterAnimating.done = true;
376376

377377
$animate.leave(domEl).then(function() {
378+
if (done) {
379+
done();
380+
}
381+
378382
domEl.remove();
379383
if (closedDeferred) {
380384
closedDeferred.resolve();
381385
}
382386
});
383387

384388
scope.$destroy();
385-
if (done) {
386-
done();
387-
}
388389
}
389390
}
390391

src/modal/test/modal.spec.js

+8-2
Original file line numberDiff line numberDiff line change
@@ -1390,15 +1390,21 @@ describe('$uibModal', function() {
13901390
expect(body).not.toHaveClass('modal-open');
13911391
});
13921392

1393-
it('should remove the custom class on closing of modal', function() {
1393+
it('should remove the custom class on closing of modal after animations have completed', function() {
13941394
var modal = open({
13951395
template: '<div>dummy modal</div>',
13961396
openedClass: 'foo'
13971397
});
13981398

13991399
expect(body).toHaveClass('foo');
14001400

1401-
close(modal);
1401+
close(modal, null, true);
1402+
expect(body).toHaveClass('foo');
1403+
1404+
$animate.flush();
1405+
$rootScope.$digest();
1406+
$animate.flush();
1407+
$rootScope.$digest();
14021408

14031409
expect(body).not.toHaveClass('foo');
14041410
});

0 commit comments

Comments
 (0)