@@ -1832,10 +1832,11 @@ QUnit.test( "non-px animation handles non-numeric start (#11971)", function( ass
18321832 this . clock . tick ( 10 ) ;
18331833} ) ;
18341834
1835- QUnit . test ( "Animation callbacks (#11797)" , function ( assert ) {
1836- assert . expect ( 15 ) ;
1835+ QUnit . test ( "Animation callbacks (#11797)" , function ( assert ) {
1836+ assert . expect ( 16 ) ;
18371837
1838- var targets = jQuery ( "#foo" ) . children ( ) ,
1838+ var prog = 0 ,
1839+ targets = jQuery ( "#foo" ) . children ( ) ,
18391840 done = false ,
18401841 expectedProgress = 0 ;
18411842
@@ -1845,7 +1846,8 @@ QUnit.test( "Animation callbacks (#11797)", function( assert ) {
18451846 assert . ok ( true , "empty: start" ) ;
18461847 } ,
18471848 progress : function ( anim , percent ) {
1848- assert . equal ( percent , 0 , "empty: progress 0" ) ;
1849+ assert . equal ( percent , prog , "empty: progress " + prog ) ;
1850+ prog = 1 ;
18491851 } ,
18501852 done : function ( ) {
18511853 assert . ok ( true , "empty: done" ) ;
@@ -1917,6 +1919,45 @@ QUnit.test( "Animation callbacks (#11797)", function( assert ) {
19171919 this . clock . tick ( 10 ) ;
19181920} ) ;
19191921
1922+ QUnit . test ( "Animation callbacks in order (#2292)" , function ( assert ) {
1923+ assert . expect ( 9 ) ;
1924+
1925+ var step = 0 ,
1926+ dur = 50 ;
1927+
1928+ // assert? -> github.com/JamesMGreene/qunit-assert-step
1929+ jQuery ( "#foo" ) . animate ( {
1930+ width : "5px"
1931+ } , {
1932+ duration : dur ,
1933+ start : function ( ) {
1934+ assert . step ( 1 ) ;
1935+ } ,
1936+ progress : function ( anim , p , ms ) {
1937+ if ( ! ( step ++ ) ) {
1938+ assert . step ( 2 ) ;
1939+ assert . strictEqual ( p , 0 , "first progress callback: progress ratio" ) ;
1940+ assert . strictEqual ( ms , dur , "first progress callback: remaining ms" ) ;
1941+ } else {
1942+ assert . step ( 3 ) ;
1943+ assert . strictEqual ( p , 1 , "last progress callback: progress ratio" ) ;
1944+ assert . strictEqual ( ms , 0 , "last progress callback: remaining ms" ) ;
1945+ }
1946+ } ,
1947+ done : function ( ) {
1948+ assert . step ( 4 ) ;
1949+ } ,
1950+ fail : function ( ) {
1951+ assert . ok ( false , "Animation failed" ) ;
1952+ } ,
1953+ always : function ( ) {
1954+ assert . step ( 5 ) ;
1955+ }
1956+ } ) . finish ( ) ;
1957+
1958+ this . clock . tick ( dur + 10 ) ;
1959+ } ) ;
1960+
19201961QUnit . test ( "Animate properly sets overflow hidden when animating width/height (#12117)" , function ( assert ) {
19211962 assert . expect ( 8 ) ;
19221963
0 commit comments