Accordion: handle active: null. Fixes #8694: 1.9 Accordion - active: null allows panels to be collapsible.

This commit is contained in:
David Petersen 2012-10-17 11:35:27 -04:00 committed by Scott González
parent 390510c705
commit c2802d7aa0
2 changed files with 11 additions and 2 deletions

View File

@ -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({

View File

@ -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