Skip to content
Permalink
Browse files

Accordion: handle active: null. Fixes #8694: 1.9 Accordion - active: …

…null allows panels to be collapsible.
  • Loading branch information...
petersendidit authored and scottgonzalez committed Oct 17, 2012
1 parent 390510c commit c2802d7aa05e6dc7731806a35d9f0057405a22c7
Showing with 11 additions and 2 deletions.
  1. +9 −0 tests/unit/accordion/accordion_options.js
  2. +2 −2 ui/jquery.ui.accordion.js
@@ -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({
@@ -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

0 comments on commit c2802d7

Please sign in to comment.
You can’t perform that action at this time.