From: louisremi Date: Tue, 10 May 2011 15:22:12 +0000 (-0400) Subject: Landing pull request 374. .animate() Callbacks should fire in correct order (unit... X-Git-Tag: 1.6.1rc1~9 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=521ae562daa8f95def8872a55a260e9bdbc40d8b;p=jquery.git Landing pull request 374. .animate() Callbacks should fire in correct order (unit test included). Fixes #9100. More Details: - https://github.com/jquery/jquery/pull/374 - https://github.com/jquery/jquery/issues/9100 --- 521ae562daa8f95def8872a55a260e9bdbc40d8b diff --cc test/unit/effects.js index ea7f4e727,6fbbbfe39..864c4a400 --- a/test/unit/effects.js +++ b/test/unit/effects.js @@@ -1003,29 -994,18 +1003,45 @@@ test("animate unit-less properties (#49 }); }); +test( "animate properties missing px w/ opacity as last (#9074)", 2, function() { + expect( 6 ); + stop(); + var div = jQuery( "
" ) + .appendTo( "#qunit-fixture" ); + function cssInt( prop ) { + return parseInt( div.css( prop ), 10 ); + } + equal( cssInt( "marginLeft" ), 0, "Margin left is 0" ); + equal( cssInt( "left" ), 0, "Left is 0" ); + div.animate({ + left: 200, + marginLeft: 200, + opacity: 0 + }, 1000); + setTimeout(function() { + var ml = cssInt( "marginLeft" ), + l = cssInt( "left" ); + notEqual( ml, 0, "Margin left is not 0 after partial animate" ); + notEqual( ml, 200, "Margin left is not 200 after partial animate" ); + notEqual( l, 0, "Left is not 0 after partial animate" ); + notEqual( l, 200, "Left is not 200 after partial animate" ); + div.stop().remove(); + start(); + }, 100); +}); ++ + test("callbacks should fire in correct order (#9100)", function() { + stop(); + var a = 1, + cb = 0, + $lis = jQuery("

").appendTo("#qunit-fixture") + // The test will always pass if no properties are animated or if the duration is 0 + .animate({fontSize: 12}, 13, function() { + a *= jQuery(this).data("operation") === "*2" ? 2 : a; + cb++; + if ( cb === 2 ) { + equal( a, 4, "test value has been *2 and _then_ ^2"); + start(); + } + }); -}); ++});