Merge "Fix jQuery compatibility issues in jquery.color.js"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Wed, 5 Mar 2014 23:52:58 +0000 (23:52 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Wed, 5 Mar 2014 23:52:58 +0000 (23:52 +0000)
resources/jquery/jquery.color.js
tests/qunit/QUnitTestResources.php
tests/qunit/suites/resources/jquery/jquery.color.test.js [new file with mode: 0644]

index 8bc45c9..04f8047 100644 (file)
@@ -14,7 +14,7 @@
                var color;
 
                do {
-                       color = $.curCSS( elem, attr );
+                       color = $.css( elem, attr );
 
                        // Keep going until we find an element that has color, or we hit the body
                        if ( color !== '' && color !== 'transparent' || $.nodeName( elem, 'body' ) ) {
                'outlineColor'
        ], function ( i, attr ) {
                $.fx.step[attr] = function ( fx ) {
-                       if ( fx.state === 0 ) {
+                       if ( !fx.colorInit ) {
                                fx.start = getColor( fx.elem, attr );
                                fx.end = $.colorUtil.getRGB( fx.end );
+                               fx.colorInit = true;
                        }
 
                        fx.elem.style[attr] = 'rgb(' + [
index 63f610f..f674819 100644 (file)
@@ -42,6 +42,7 @@ return array(
                        'tests/qunit/suites/resources/jquery/jquery.byteLength.test.js',
                        'tests/qunit/suites/resources/jquery/jquery.byteLimit.test.js',
                        'tests/qunit/suites/resources/jquery/jquery.client.test.js',
+                       'tests/qunit/suites/resources/jquery/jquery.color.test.js',
                        'tests/qunit/suites/resources/jquery/jquery.colorUtil.test.js',
                        'tests/qunit/suites/resources/jquery/jquery.delayedBind.test.js',
                        'tests/qunit/suites/resources/jquery/jquery.getAttrs.test.js',
@@ -74,6 +75,7 @@ return array(
                        'jquery.byteLength',
                        'jquery.byteLimit',
                        'jquery.client',
+                       'jquery.color',
                        'jquery.colorUtil',
                        'jquery.delayedBind',
                        'jquery.getAttrs',
diff --git a/tests/qunit/suites/resources/jquery/jquery.color.test.js b/tests/qunit/suites/resources/jquery/jquery.color.test.js
new file mode 100644 (file)
index 0000000..b644a3c
--- /dev/null
@@ -0,0 +1,15 @@
+( function ( $ ) {
+       QUnit.module( 'jquery.color', QUnit.newMwEnvironment() );
+
+       QUnit.asyncTest( 'animate', 3, function ( assert ) {
+               var $canvas = $( '<div>' ).css( 'background-color', '#fff' );
+
+               $canvas.animate( { backgroundColor: '#000' }, 4 ).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();
+               } );
+       } );
+}( jQuery ) );