angular / angular.js

AngularJS - HTML enhanced for web apps!
https://angularjs.org
MIT License
58.8k stars 27.48k forks source link

$animate.flush() does not flush $animateCss animations in queue #13005

Closed wesleycho closed 8 years ago

wesleycho commented 9 years ago

We have an issue in https://github.com/angular-ui/bootstrap/pull/4493 where it turns out that $animate.flush() does not flush the animations queued up by $animateCss, so the expandDone callback in the promise chain never fires in the collapse directive, which is causing some testing problems.

In particular, the .then callback in the promise returned by $animateCss(...).start() never gets called because there is no mechanism in ngMock for flushing out the queued animation.

matsko commented 9 years ago

I think it may be best to include a flushRunningAnimations method instead that does this plus everything that flush. We could also have another method called flushCallbacks that does this and have flush handle flushing pending animations as well as their associated callbacks.

matsko commented 9 years ago

@petebacondarwin and @IgorMinar what do you gentlemen you think?

wesleycho commented 9 years ago

Should note we were able to work around it by changing to finally, but it probably is a good thing to implement a solution at some point.