fix($animate): ensure that class-based animations only consider the most recent DOM operations

Prior to this fix $animate would maintain a count of each time a class was
added and removed within $animate. With this fix, $animate instead only cares
about the most recent class times that the classes were added and/or removed
and it will only remember a total of one addClass or removeClass operation per
className.

```
// before
addClass    => 1
removeClass => 0
addClass    => 1
addClass    => 2
addClass    => 3
removeClass => 2
removeClass => 1
// since 1 > 0 then this will cause an addClass animation

// now
addClass    => 1
removeClass => 0
addClass    => 1
addClass    => 1
addClass    => 1
removeClass => 0
removeClass => -1
// since 1 < 0 then this will cause an removeClass animation
```

Closes #8946
The one test that you added will not fail using the approach I showed, so if you're making it fail you're doing something different. It's simple, when you add a class, we set the state of the operation for that class to 1, and when you remove a class, you set it to some other value (in this case -1) --- because of this, only the most recent operation for any one class will matter, which is what we want (I'm not seeing any other scenario in your test case). When adding or removing classes, we can also check whether the element already has or does not have the class, but realistically this doesn't matter a whole lot (it just helps for testing).

So, under what circumstance (which is not being tested here) do we care about the "when the classes cancel each other out"?