]> source.dussan.org Git - jquery-ui.git/commitdiff
Accordion: Only adjust height animations for heightStyle: content. Fix tests that...
authorScott González <scott.gonzalez@gmail.com>
Mon, 1 Oct 2012 20:52:54 +0000 (16:52 -0400)
committerScott González <scott.gonzalez@gmail.com>
Mon, 1 Oct 2012 20:52:54 +0000 (16:52 -0400)
tests/unit/accordion/accordion_options.js
ui/jquery.ui.accordion.js

index 2b8222f5c1039e87a60fae98d91756c0223c33ff..5d950e1acd980f7edd46806a603a12c2c50c3b2b 100644 (file)
@@ -105,9 +105,9 @@ asyncTest( "{ animate: Number }", function() {
                panels = element.find( ".ui-accordion-content" ),
                animate = $.fn.animate;
        // called twice (both panels)
-       $.fn.animate = function( props, duration, easing ) {
-               equal( duration, 100, "correct duration" );
-               equal( easing, undefined, "default easing" );
+       $.fn.animate = function( props, options ) {
+               equal( options.duration, 100, "correct duration" );
+               equal( options.easing, undefined, "default easing" );
                animate.apply( this, arguments );
        };
 
@@ -129,9 +129,9 @@ asyncTest( "{ animate: String }", function() {
                panels = element.find( ".ui-accordion-content" ),
                animate = $.fn.animate;
        // called twice (both panels)
-       $.fn.animate = function( props, duration, easing ) {
-               equal( duration, undefined, "default duration" );
-               equal( easing, "linear", "correct easing" );
+       $.fn.animate = function( props, options ) {
+               equal( options.duration, undefined, "default duration" );
+               equal( options.easing, "linear", "correct easing" );
                animate.apply( this, arguments );
        };
 
@@ -153,9 +153,9 @@ asyncTest( "{ animate: {} }", function() {
                panels = element.find( ".ui-accordion-content" ),
                animate = $.fn.animate;
        // called twice (both panels)
-       $.fn.animate = function( props, duration, easing ) {
-               equal( duration, undefined, "default duration" );
-               equal( easing, undefined, "default easing" );
+       $.fn.animate = function( props, options ) {
+               equal( options.duration, undefined, "default duration" );
+               equal( options.easing, undefined, "default easing" );
                animate.apply( this, arguments );
        };
 
@@ -177,9 +177,9 @@ asyncTest( "{ animate: { duration, easing } }", function() {
                panels = element.find( ".ui-accordion-content" ),
                animate = $.fn.animate;
        // called twice (both panels)
-       $.fn.animate = function( props, duration, easing ) {
-               equal( duration, 100, "correct duration" );
-               equal( easing, "linear", "correct easing" );
+       $.fn.animate = function( props, options ) {
+               equal( options.duration, 100, "correct duration" );
+               equal( options.easing, "linear", "correct easing" );
                animate.apply( this, arguments );
        };
 
@@ -202,9 +202,9 @@ asyncTest( "{ animate: { duration, easing } }, animate down", function() {
                panels = element.find( ".ui-accordion-content" ),
                animate = $.fn.animate;
        // called twice (both panels)
-       $.fn.animate = function( props, duration, easing ) {
-               equal( duration, 100, "correct duration" );
-               equal( easing, "linear", "correct easing" );
+       $.fn.animate = function( props, options ) {
+               equal( options.duration, 100, "correct duration" );
+               equal( options.easing, "linear", "correct easing" );
                animate.apply( this, arguments );
        };
 
@@ -233,9 +233,9 @@ asyncTest( "{ animate: { duration, easing, down } }, animate down", function() {
                panels = element.find( ".ui-accordion-content" ),
                animate = $.fn.animate;
        // called twice (both panels)
-       $.fn.animate = function( props, duration, easing ) {
-               equal( duration, 100, "correct duration" );
-               equal( easing, "swing", "correct easing" );
+       $.fn.animate = function( props, options ) {
+               equal( options.duration, 100, "correct duration" );
+               equal( options.easing, "swing", "correct easing" );
                animate.apply( this, arguments );
        };
 
index bc3cbfcc6f65c4b2574d9d16a6b4784c2e617787..48e880a057cb8f05d6c47d0935dbca1eb1c760b1 100644 (file)
@@ -518,10 +518,10 @@ $.widget( "ui.accordion", {
                                easing: easing,
                                complete: complete,
                                step: function( now, fx ) {
+                                       fx.now = Math.round( now );
                                        if ( fx.prop !== "height" ) {
-                                               fx.now = Math.round( now );
                                                adjust += fx.now;
-                                       } else {
+                                       } else if ( that.options.heightStyle !== "content" ) {
                                                fx.now = Math.round( total - toHide.outerHeight() - adjust );
                                                adjust = 0;
                                        }