]> source.dussan.org Git - jquery-ui.git/commitdiff
Unit Tests & effects.scale: Fixing bugs in effects unit tests - Particularly IE,... 310/head
authorgnarf <gnarf@gnarf.net>
Wed, 18 May 2011 23:13:37 +0000 (18:13 -0500)
committergnarf <gnarf@gnarf.net>
Wed, 18 May 2011 23:13:37 +0000 (18:13 -0500)
tests/unit/effects/effects.html
tests/unit/effects/effects_core.js
ui/jquery.effects.core.js
ui/jquery.effects.scale.js

index 0879a98b2353b53e03a5df8944e705c6ffd2efa9..84fecd9ccc04acad43af90f2515eeaf4c27c2aa9 100644 (file)
                .test {
                        background: #000;
                        border: 0;
+                       width: 100px;
+                       height: 100px;
                }
                .testAddBorder {
                        border: 10px solid #000;
                }
+               .testChildren,
                .testChangeBackground {
                        background: #fff;
                }
index 8d2e8f8df9ac5dbebbe1d6ea95e4a38938a7f5e0..ed9fbf9ba0e1be2797e5f5ecbff78344448e3e48 100644 (file)
@@ -77,12 +77,12 @@ asyncTest( "animateClass works with colors", function() {
                count = 0;
        expect(2);
        test.toggleClass("testChangeBackground", duration, function() {
-               present( test.css("backgroundColor"), [ "#ffffff", "rgb(255, 255, 255)" ], "Color is final" );
+               present( test.css("backgroundColor"), [ "#ffffff", "#fff", "rgb(255, 255, 255)" ], "Color is final" );
                start();
        });
        setTimeout(function() {
                var color = test.css("backgroundColor");
-               notPresent( color, [ "#000000", "#ffffff", "rgb(0, 0, 0)", "rgb(255,255,255)" ],
+               notPresent( color, [ "#000000", "#ffffff", "#000", "#fff", "rgb(0, 0, 0)", "rgb(255,255,255)" ],
                        "Color is not endpoints in middle." );
        }, mid);
 });
@@ -92,19 +92,20 @@ asyncTest( "animateClass works with children", function() {
                h2 = test.find("h2");
 
        expect(4);
+       setTimeout(function() {
+               notPresent( h2.css("fontSize"), ["10px","20px"], "Font size is neither endpoint when in middle.");
+       }, mid);
        test.toggleClass("testChildren", { children: true, duration: duration, complete: function() {
                equal( h2.css("fontSize"), "20px", "Text size is final during complete");
                test.toggleClass("testChildren", duration, function() {
                        equal( h2.css("fontSize"), "10px", "Text size revertted after class removed");
+
                        start();
                });
                setTimeout(function() {
-                       equal( h2.css("fontSize"), "20px", "Text size unchanged with children: undefined" );
+                       equal( h2.css("fontSize"), "20px", "Text size unchanged during animate with children: undefined" );
                }, mid);
        }});
-       setTimeout(function() {
-               notPresent( h2.css("fontSize"), ["10px","20px"], "Font size is neither endpoint when in middle.");
-       }, mid);
 });
 
 })(jQuery);
index 638119579751c6e5da9c767890d08e02d7182453..7650aa8f4e664e33139a31f244b6c290e3f7331e 100644 (file)
@@ -451,7 +451,7 @@ $.extend( $.effects, {
        setTransition: function( element, list, factor, value ) {
                value = value || {};
                $.each( list, function(i, x){
-                       unit = element.cssUnit( x );
+                       var unit = element.cssUnit( x );
                        if ( unit[ 0 ] > 0 ) value[ x ] = unit[ 0 ] * factor + unit[ 1 ];
                });
                return value;
index 843aa2241dfb3e334ce86384bcdb1c35ba4cae6a..b5c49ce7c648c7f732bf86c725fd6f39b9df060a 100644 (file)
@@ -115,11 +115,15 @@ $.effects.effect.size = function( o ) {
                        restore = o.restore || false,
                        scale = o.scale || 'both',
                        origin = o.origin,
-                       original = {
-                               height: el.height(), 
-                               width: el.width()
-                       },
-                       baseline, factor;
+                       original, baseline, factor;
+
+               if ( mode === "show" ) {
+                       el.show();
+               }
+               original = {
+                       height: el.height(), 
+                       width: el.width()
+               };
 
                el.from = o.from || original;
                el.to = o.to || original;
@@ -149,14 +153,14 @@ $.effects.effect.size = function( o ) {
                if ( scale == 'box' || scale == 'both' ) {
 
                        // Vertical props scaling
-                       if ( factor.from.y != factor.to.y ) { 
+                       if ( factor.from.y !== factor.to.y ) { 
                                props = props.concat( vProps );
                                el.from = $.effects.setTransition( el, vProps, factor.from.y, el.from );
                                el.to = $.effects.setTransition( el, vProps, factor.to.y, el.to );
                        };
 
                        // Horizontal props scaling
-                       if ( factor.from.x != factor.to.x ) { 
+                       if ( factor.from.x !== factor.to.x ) { 
                                props = props.concat( hProps );
                                el.from = $.effects.setTransition( el, hProps, factor.from.x, el.from );
                                el.to = $.effects.setTransition( el, hProps, factor.to.x, el.to );
@@ -167,7 +171,7 @@ $.effects.effect.size = function( o ) {
                if ( scale == 'content' || scale == 'both' ) { 
 
                        // Vertical props scaling
-                       if ( factor.from.y != factor.to.y ) { 
+                       if ( factor.from.y !== factor.to.y ) { 
                                props = props.concat( cProps );
                                el.from = $.effects.setTransition( el, cProps, factor.from.y, el.from );
                                el.to = $.effects.setTransition( el, cProps, factor.to.y, el.to );