ngAnimate & ngClass - Does not remove a class that is still animating #14582
Description
Do you want to request a feature or report a bug?
Bug
What is the current behavior?
http://plnkr.co/edit/wsVFlxSJFCslfV9Hossg?p=preview
When a class is added via ngClass then removed too quickly we end up in a state where still have the class on the element.
If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem.
http://plnkr.co/edit/wsVFlxSJFCslfV9Hossg?p=preview
*This is a race condition. This plunker is failing over 90% of the time though,
What is the expected behavior?
The falsy ngClass is removed
What is the motivation / use case for changing the behavior?
Which versions of Angular, and which browser / OS are affected by this issue? Did this work in previous versions of Angular? Please also test with the latest stable and snapshot (https://code.angularjs.org/snapshot/) versions.
Plnkr was failing in 1.4 -> 1.5.5
Other information (e.g. stacktraces, related issues, suggestions how to fix)
Definitely related to ngAnimate as the issue goes away when its not used.
Likely related to the intermediate animate states. In the plunker above we would see .background-add on the element at the time we try to remove .background
This appears to only happen when the new ngClass state is also adding classes.