diff --git a/tests/unit/accordion/accordion.html b/tests/unit/accordion/accordion.html index 683b87456cb..ce58567552b 100644 --- a/tests/unit/accordion/accordion.html +++ b/tests/unit/accordion/accordion.html @@ -8,12 +8,16 @@ @@ -109,6 +113,19 @@

Drums

+
+
+

Header

+
+

+ The calculated height of this accordion should be the same + regardless of whether the accordion was collapsed or not + when the height was calculated. +

+
+
+
+ diff --git a/tests/unit/accordion/options.js b/tests/unit/accordion/options.js index c95738c4395..82ca625e49a 100644 --- a/tests/unit/accordion/options.js +++ b/tests/unit/accordion/options.js @@ -48,6 +48,19 @@ test( "{ active: false }", function() { strictEqual( element.accordion( "option", "active" ), 0 ); }); +// http://bugs.jqueryui.com/ticket/11938 +test( "{ active: false, collapsible: true }", function() { + expect( 1 ); + var element = $( "#collapsible" ).accordion(), + content = element.find( ".ui-accordion-content" ), + height = content.height(); + element.accordion( "destroy" ).accordion({ + active: false, + collapsible: true + }); + equal( content.height(), height ); +}); + test( "{ active: Number }", function() { expect( 8 ); var element = $( "#list1" ).accordion({ diff --git a/ui/accordion.js b/ui/accordion.js index 64635271586..00af1d62145 100644 --- a/ui/accordion.js +++ b/ui/accordion.js @@ -361,7 +361,14 @@ return $.widget( "ui.accordion", { maxHeight = 0; this.headers.next() .each( function() { + var isVisible = $( this ).is( ":visible" ); + if ( !isVisible ) { + $( this ).show(); + } maxHeight = Math.max( maxHeight, $( this ).css( "height", "" ).height() ); + if ( !isVisible ) { + $( this ).hide(); + } } ) .height( maxHeight ); }