@@ -1849,10 +1849,11 @@ QUnit.test( "non-px animation handles non-numeric start (#11971)", function( ass
18491849 this . clock . tick ( 10 ) ;
18501850} ) ;
18511851
1852- QUnit . test ( "Animation callbacks (#11797)" , function ( assert ) {
1853- assert . expect ( 15 ) ;
1852+ QUnit . test ( "Animation callbacks (#11797)" , function ( assert ) {
1853+ assert . expect ( 16 ) ;
18541854
1855- var targets = jQuery ( "#foo" ) . children ( ) ,
1855+ var prog = 0 ,
1856+ targets = jQuery ( "#foo" ) . children ( ) ,
18561857 done = false ,
18571858 expectedProgress = 0 ;
18581859
@@ -1862,7 +1863,8 @@ QUnit.test( "Animation callbacks (#11797)", function( assert ) {
18621863 assert . ok ( true , "empty: start" ) ;
18631864 } ,
18641865 progress : function ( anim , percent ) {
1865- assert . equal ( percent , 0 , "empty: progress 0" ) ;
1866+ assert . equal ( percent , prog , "empty: progress " + prog ) ;
1867+ prog = 1 ;
18661868 } ,
18671869 done : function ( ) {
18681870 assert . ok ( true , "empty: done" ) ;
@@ -1934,6 +1936,45 @@ QUnit.test( "Animation callbacks (#11797)", function( assert ) {
19341936 this . clock . tick ( 10 ) ;
19351937} ) ;
19361938
1939+ QUnit . test ( "Animation callbacks in order (#2292)" , function ( assert ) {
1940+ assert . expect ( 9 ) ;
1941+
1942+ var step = 0 ,
1943+ dur = 50 ;
1944+
1945+ // assert? -> github.com/JamesMGreene/qunit-assert-step
1946+ jQuery ( "#foo" ) . animate ( {
1947+ width : "5px"
1948+ } , {
1949+ duration : dur ,
1950+ start : function ( ) {
1951+ assert . step ( 1 ) ;
1952+ } ,
1953+ progress : function ( anim , p , ms ) {
1954+ if ( ! ( step ++ ) ) {
1955+ assert . step ( 2 ) ;
1956+ assert . strictEqual ( p , 0 , "first progress callback: progress ratio" ) ;
1957+ assert . strictEqual ( ms , dur , "first progress callback: remaining ms" ) ;
1958+ } else {
1959+ assert . step ( 3 ) ;
1960+ assert . strictEqual ( p , 1 , "last progress callback: progress ratio" ) ;
1961+ assert . strictEqual ( ms , 0 , "last progress callback: remaining ms" ) ;
1962+ }
1963+ } ,
1964+ done : function ( ) {
1965+ assert . step ( 4 ) ;
1966+ } ,
1967+ fail : function ( ) {
1968+ assert . ok ( false , "Animation failed" ) ;
1969+ } ,
1970+ always : function ( ) {
1971+ assert . step ( 5 ) ;
1972+ }
1973+ } ) . finish ( ) ;
1974+
1975+ this . clock . tick ( dur + 10 ) ;
1976+ } ) ;
1977+
19371978QUnit . test ( "Animate properly sets overflow hidden when animating width/height (#12117)" , function ( assert ) {
19381979 assert . expect ( 8 ) ;
19391980
0 commit comments