11( function ( $ ) {
22
3+ function present ( value , array , message ) {
4+ QUnit . push ( jQuery . inArray ( value , array ) !== - 1 , value , array , message ) ;
5+ }
6+
7+ function notPresent ( value , array , message ) {
8+ QUnit . push ( jQuery . inArray ( value , array ) === - 1 , value , array , message ) ;
9+ }
10+
311var animateTime = 15 ;
412
513module ( "effects.core" ) ;
@@ -8,12 +16,10 @@ $.each( $.effects.effect, function( effect ) {
816 if ( effect === "transfer" ) {
917 return ;
1018 }
11- QUnit . reset ( ) ;
1219 module ( "effect." + effect ) ;
13- test ( "show/hide" , function ( ) {
20+ asyncTest ( "show/hide" , function ( ) {
1421 var hidden = $ ( "div.hidden" ) ;
1522 expect ( 8 ) ;
16- stop ( ) ;
1723
1824 var count = 0 ,
1925 test = 0 ;
@@ -23,24 +29,55 @@ $.each( $.effects.effect, function( effect ) {
2329 var point = count ;
2430 return function ( next ) {
2531 test ++ ;
26- equals ( point , test , "Queue function fired in order" ) ;
32+ equal ( point , test , "Queue function fired in order" ) ;
2733 if ( fn ) {
28- fn ( )
34+ fn ( ) ;
2935 } else {
3036 setTimeout ( next , animateTime ) ;
3137 }
32- }
38+ } ;
3339 }
3440
3541 hidden . queue ( queueTest ( ) ) . show ( effect , animateTime , queueTest ( function ( ) {
3642 equal ( hidden . css ( "display" ) , "block" , "Hidden is shown after .show(\"" + effect + "\", time)" ) ;
3743 } ) ) . queue ( queueTest ( ) ) . hide ( effect , animateTime , queueTest ( function ( ) {
3844 equal ( hidden . css ( "display" ) , "none" , "Back to hidden after .hide(\"" + effect + "\", time)" ) ;
3945 } ) ) . queue ( queueTest ( function ( next ) {
40- deepEqual ( hidden . queue ( ) , [ "inprogress" ] , "Only the inprogress sentinel remains" )
46+ deepEqual ( hidden . queue ( ) , [ "inprogress" ] , "Only the inprogress sentinel remains" ) ;
4147 start ( ) ;
4248 } ) ) ;
4349 } ) ;
4450} ) ;
4551
52+ module ( "animateClass" ) ;
53+
54+ asyncTest ( "animateClass works with borderStyle" , function ( ) {
55+ var test = $ ( "div.animateClass" ) ,
56+ count = 0 ;
57+ expect ( 3 ) ;
58+ test . toggleClass ( "testAddBorder" , 20 , function ( ) {
59+ test . toggleClass ( "testAddBorder" , 20 , function ( ) {
60+ equal ( test . css ( "borderLeftStyle" ) , "none" , "None border set" ) ;
61+ start ( ) ;
62+ } ) ;
63+ equal ( test . css ( "borderLeftStyle" ) , "solid" , "None border not immedately set" ) ;
64+ } ) ;
65+ equal ( test . css ( "borderLeftStyle" ) , "solid" , "Solid border immedately set" ) ;
66+ } ) ;
67+
68+ asyncTest ( "animateClass works with colors" , function ( ) {
69+ var test = $ ( "div.animateClass" ) ,
70+ count = 0 ;
71+ expect ( 2 ) ;
72+ test . toggleClass ( "testChangeBackground" , 100 , function ( ) {
73+ present ( test . css ( "backgroundColor" ) , [ "#ffffff" , "rgb(255, 255, 255)" ] , "Color is final" ) ;
74+ start ( ) ;
75+ } ) ;
76+ setTimeout ( function ( ) {
77+ var color = test . css ( "backgroundColor" ) ;
78+ notPresent ( color , [ "#000000" , "#ffffff" , "rgb(0, 0, 0)" , "rgb(255,255,255)" ] ,
79+ "Color is not endpoints in middle." ) ;
80+ } , 50 ) ;
81+ } ) ;
82+
4683} ) ( jQuery ) ;
0 commit comments