aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMatias Niemelä2013-08-06 14:15:01 -0400
committerMisko Hevery2013-08-09 14:39:58 -0700
commit2430347ece2f7a74a35d3ab0095ecc895884670e (patch)
treeab511eba8f20c7752a5ed8ebe5ffc2b5668ee6e5 /test
parentf61ff695192df2123ea086ddd5fe65e27e9b4e18 (diff)
downloadangular.js-2430347ece2f7a74a35d3ab0095ecc895884670e.tar.bz2
fix(ngAnimate): make sure that the class value passed into addClass/removeClass is the base class string value
Diffstat (limited to 'test')
-rw-r--r--test/ngAnimate/animateSpec.js32
1 files changed, 32 insertions, 0 deletions
diff --git a/test/ngAnimate/animateSpec.js b/test/ngAnimate/animateSpec.js
index e5ade9f3..30bf6ba7 100644
--- a/test/ngAnimate/animateSpec.js
+++ b/test/ngAnimate/animateSpec.js
@@ -1513,4 +1513,36 @@ describe("ngAnimate", function() {
});
});
+ it("should provide the correct CSS class to the addClass and removeClass callbacks within a JS animation", function() {
+ module(function($animateProvider) {
+ $animateProvider.register('.classify', function($timeout) {
+ return {
+ removeClass : function(element, className, done) {
+ element.data('classify','remove-' + className);
+ done();
+ },
+ addClass : function(element, className, done) {
+ element.data('classify','add-' + className);
+ done();
+ }
+ }
+ });
+ })
+ inject(function($compile, $rootScope, $animate, $timeout) {
+ var element = html($compile('<div class="classify"></div>')($rootScope));
+
+ $animate.addClass(element, 'super');
+ expect(element.data('classify')).toBe('add-super');
+ $timeout.flush();
+
+ $animate.removeClass(element, 'super');
+ expect(element.data('classify')).toBe('remove-super');
+ $timeout.flush();
+
+ $animate.addClass(element, 'superguy');
+ expect(element.data('classify')).toBe('add-superguy');
+ $timeout.flush();
+ });
+ });
+
});