Navigation Menu

Skip to content

Commit

Permalink
Accordion: handle active: null. Fixes #8694: 1.9 Accordion - active: …
Browse files Browse the repository at this point in the history
…null allows panels to be collapsible.
  • Loading branch information
petersendidit authored and scottgonzalez committed Oct 18, 2012
1 parent 390510c commit c2802d7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
9 changes: 9 additions & 0 deletions tests/unit/accordion/accordion_options.js
Expand Up @@ -13,6 +13,15 @@ test( "{ active: default }", function() {
state( element, 1, 0, 0 );
});

test( "{ active: null }", function() {
expect( 2 );
var element = $( "#list1" ).accordion({
active: null
});
equal( element.accordion( "option", "active" ), 0 );
state( element, 1, 0, 0 );
});

test( "{ active: false }", function() {
expect( 7 );
var element = $( "#list1" ).accordion({
Expand Down
4 changes: 2 additions & 2 deletions ui/jquery.ui.accordion.js
Expand Up @@ -59,8 +59,8 @@ $.widget( "ui.accordion", {
.addClass( "ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom" )
.hide();

// don't allow collapsible: false and active: false
if ( !options.collapsible && options.active === false ) {
// don't allow collapsible: false and active: false / null
if ( !options.collapsible && ( !options.active || typeof options.active !== "number" ) ) {
options.active = 0;
}
// handle negative values
Expand Down

0 comments on commit c2802d7

Please sign in to comment.