Skip to content

Commit 2c50b1b

Browse files
committed
Accordion: Only adjust height animations for heightStyle: content. Fix tests that punch .animate().
1 parent d20f05e commit 2c50b1b

File tree

2 files changed

+20
-20
lines changed

2 files changed

+20
-20
lines changed

tests/unit/accordion/accordion_options.js

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,9 @@ asyncTest( "{ animate: Number }", function() {
105105
panels = element.find( ".ui-accordion-content" ),
106106
animate = $.fn.animate;
107107
// called twice (both panels)
108-
$.fn.animate = function( props, duration, easing ) {
109-
equal( duration, 100, "correct duration" );
110-
equal( easing, undefined, "default easing" );
108+
$.fn.animate = function( props, options ) {
109+
equal( options.duration, 100, "correct duration" );
110+
equal( options.easing, undefined, "default easing" );
111111
animate.apply( this, arguments );
112112
};
113113

@@ -129,9 +129,9 @@ asyncTest( "{ animate: String }", function() {
129129
panels = element.find( ".ui-accordion-content" ),
130130
animate = $.fn.animate;
131131
// called twice (both panels)
132-
$.fn.animate = function( props, duration, easing ) {
133-
equal( duration, undefined, "default duration" );
134-
equal( easing, "linear", "correct easing" );
132+
$.fn.animate = function( props, options ) {
133+
equal( options.duration, undefined, "default duration" );
134+
equal( options.easing, "linear", "correct easing" );
135135
animate.apply( this, arguments );
136136
};
137137

@@ -153,9 +153,9 @@ asyncTest( "{ animate: {} }", function() {
153153
panels = element.find( ".ui-accordion-content" ),
154154
animate = $.fn.animate;
155155
// called twice (both panels)
156-
$.fn.animate = function( props, duration, easing ) {
157-
equal( duration, undefined, "default duration" );
158-
equal( easing, undefined, "default easing" );
156+
$.fn.animate = function( props, options ) {
157+
equal( options.duration, undefined, "default duration" );
158+
equal( options.easing, undefined, "default easing" );
159159
animate.apply( this, arguments );
160160
};
161161

@@ -177,9 +177,9 @@ asyncTest( "{ animate: { duration, easing } }", function() {
177177
panels = element.find( ".ui-accordion-content" ),
178178
animate = $.fn.animate;
179179
// called twice (both panels)
180-
$.fn.animate = function( props, duration, easing ) {
181-
equal( duration, 100, "correct duration" );
182-
equal( easing, "linear", "correct easing" );
180+
$.fn.animate = function( props, options ) {
181+
equal( options.duration, 100, "correct duration" );
182+
equal( options.easing, "linear", "correct easing" );
183183
animate.apply( this, arguments );
184184
};
185185

@@ -202,9 +202,9 @@ asyncTest( "{ animate: { duration, easing } }, animate down", function() {
202202
panels = element.find( ".ui-accordion-content" ),
203203
animate = $.fn.animate;
204204
// called twice (both panels)
205-
$.fn.animate = function( props, duration, easing ) {
206-
equal( duration, 100, "correct duration" );
207-
equal( easing, "linear", "correct easing" );
205+
$.fn.animate = function( props, options ) {
206+
equal( options.duration, 100, "correct duration" );
207+
equal( options.easing, "linear", "correct easing" );
208208
animate.apply( this, arguments );
209209
};
210210

@@ -233,9 +233,9 @@ asyncTest( "{ animate: { duration, easing, down } }, animate down", function() {
233233
panels = element.find( ".ui-accordion-content" ),
234234
animate = $.fn.animate;
235235
// called twice (both panels)
236-
$.fn.animate = function( props, duration, easing ) {
237-
equal( duration, 100, "correct duration" );
238-
equal( easing, "swing", "correct easing" );
236+
$.fn.animate = function( props, options ) {
237+
equal( options.duration, 100, "correct duration" );
238+
equal( options.easing, "swing", "correct easing" );
239239
animate.apply( this, arguments );
240240
};
241241

ui/jquery.ui.accordion.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -518,10 +518,10 @@ $.widget( "ui.accordion", {
518518
easing: easing,
519519
complete: complete,
520520
step: function( now, fx ) {
521+
fx.now = Math.round( now );
521522
if ( fx.prop !== "height" ) {
522-
fx.now = Math.round( now );
523523
adjust += fx.now;
524-
} else {
524+
} else if ( that.options.heightStyle !== "content" ) {
525525
fx.now = Math.round( total - toHide.outerHeight() - adjust );
526526
adjust = 0;
527527
}

0 commit comments

Comments
 (0)