]> source.dussan.org Git - jquery.git/commitdiff
Fix per-property easing. Fixes #9067
authorDaniel Pihlstrom <sciolist.se@gmail.com>
Tue, 3 May 2011 23:07:24 +0000 (01:07 +0200)
committertimmywil <tim.willison@thisismedium.com>
Sat, 7 May 2011 23:28:07 +0000 (19:28 -0400)
src/effects.js
test/unit/effects.js

index 7023461b351ebf3b9cede167258462f5454ddf66..06be2c60530fd5111101e11a3f1199ee5debf640 100644 (file)
@@ -191,9 +191,12 @@ jQuery.fn.extend({
                                }
 
                                // easing resolution: per property > opt.specialEasing > opt.easing > 'swing' (default)
-                               opt.animatedProperties[name] = jQuery.isArray( val ) ?
-                                       val[1]:
-                                       opt.specialEasing && opt.specialEasing[name] || opt.easing || 'swing';
+                               if(jQuery.isArray(val)) {
+                                       opt.animatedProperties[name] = val[1];
+                                       prop[name] = val[0];
+                               } else {
+                                       opt.animatedProperties[name] = easing || opt.specialEasing && opt.specialEasing[name] || opt.easing || 'swing';
+                               }
                        }
 
                        if ( opt.overflow != null ) {
index 2a43c115b1665796fc07bcd2144f7fac0d08012b..a98b0987d86312ed331b4cdbff3e329226ff854c 100644 (file)
@@ -923,9 +923,10 @@ test("jQuery.show('fast') doesn't clear radio buttons (bug #1095)", function ()
 
 test("animate with per-property easing", function(){
 
-       expect(3);
+       expect(5);
        stop();
 
+       var data = {a:0,b:0,c:0};
        var _test1_called = false;
        var _test2_called = false;
        var _default_test_called = false;
@@ -934,23 +935,30 @@ test("animate with per-property easing", function(){
                _test1_called = true;
        };
 
-       jQuery.easing["_test2"] = function() {
+       jQuery.easing["_test2"] = function(p) {
                _test2_called = true;
+               return p;
        };
 
-       jQuery.easing["_default_test"] = function() {
+       jQuery.easing["_default_test"] = function(p) {
                _default_test_called = true;
+               return p;
        };
 
-       jQuery({a:0,b:0,c:0}).animate({
+       jQuery(data).animate({
                a: [100, "_test1"],
                b: [100, "_test2"],
                c: 100
        }, 400, "_default_test", function(){
                start();
+
                ok(_test1_called, "Easing function (1) called");
+
                ok(_test2_called, "Easing function (2) called");
+               ok(data.b == 100, "Easing function (2) assigned correct value");
+
                ok(_default_test_called, "Easing function (_default) called");
+               ok(data.c == 100, "Easing function (_default) assigned correct value");
        });
 
 });