aboutsummaryrefslogtreecommitdiffstats
path: root/test/ngAnimate/animateSpec.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/ngAnimate/animateSpec.js')
-rw-r--r--test/ngAnimate/animateSpec.js31
1 files changed, 31 insertions, 0 deletions
diff --git a/test/ngAnimate/animateSpec.js b/test/ngAnimate/animateSpec.js
index 028c021f..db40d544 100644
--- a/test/ngAnimate/animateSpec.js
+++ b/test/ngAnimate/animateSpec.js
@@ -2665,6 +2665,37 @@ describe("ngAnimate", function() {
expect(element.hasClass('red')).toBe(true);
}));
+ it("should avoid mixing up substring classes during add and remove operations", function() {
+ var currentAnimation, currentFn;
+ module(function($animateProvider) {
+ $animateProvider.register('.on', function() {
+ return {
+ beforeAddClass : function(element, className, done) {
+ currentAnimation = 'addClass';
+ currentFn = done;
+ },
+ beforeRemoveClass : function(element, className, done) {
+ currentAnimation = 'removeClass';
+ currentFn = done;
+ }
+ };
+ });
+ });
+ inject(function($compile, $rootScope, $animate, $sniffer, $timeout) {
+ var element = $compile('<div class="animation-enabled only"></div>')($rootScope);
+ $rootElement.append(element);
+ jqLite($document[0].body).append($rootElement);
+
+ $animate.addClass(element, 'on');
+ expect(currentAnimation).toBe('addClass');
+ currentFn();
+
+ $animate.removeClass(element, 'on');
+ $animate.addClass(element, 'on');
+
+ expect(currentAnimation).toBe('addClass');
+ });
+ });
it('should enable and disable animations properly on the root element', function() {
var count = 0;