jquery.color.test: Use fake timers
[lhc/web/wiklou.git] / tests / qunit / suites / resources / jquery / jquery.color.test.js
index 839c5d5..c8e8ac7 100644 (file)
@@ -1,15 +1,18 @@
 ( function ( $ ) {
-       QUnit.module( 'jquery.color', QUnit.newMwEnvironment() );
+       QUnit.module( 'jquery.color', QUnit.newMwEnvironment( {
+               setup: function () {
+                       this.clock = this.sandbox.useFakeTimers();
+               }
+       } ) );
 
-       QUnit.asyncTest( 'animate', 3, function ( assert ) {
+       QUnit.test( 'animate', 1, function ( assert ) {
                var $canvas = $( '<div>' ).css( 'background-color', '#fff' );
 
-               $canvas.animate( { backgroundColor: '#000' }, 4 ).promise().then( function () {
+               $canvas.animate( { backgroundColor: '#000' }, 10 ).promise().then( function () {
                        var endColors = $.colorUtil.getRGB( $canvas.css( 'background-color' ) );
-                       assert.strictEqual( endColors[0], 0 );
-                       assert.strictEqual( endColors[1], 0 );
-                       assert.strictEqual( endColors[2], 0 );
-                       QUnit.start();
+                       assert.deepEqual( endColors, [0, 0, 0], 'end state' );
                } );
+
+               this.clock.tick( 20 );
        } );
 }( jQuery ) );