diff options
-rw-r--r-- | tests/unit/accordion/accordion_options.js | 9 | ||||
-rw-r--r-- | ui/jquery.ui.accordion.js | 4 |
2 files changed, 11 insertions, 2 deletions
diff --git a/tests/unit/accordion/accordion_options.js b/tests/unit/accordion/accordion_options.js index 5d950e1ac..8f0d0637f 100644 --- a/tests/unit/accordion/accordion_options.js +++ b/tests/unit/accordion/accordion_options.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({ diff --git a/ui/jquery.ui.accordion.js b/ui/jquery.ui.accordion.js index 48e880a05..ff07a8e93 100644 --- a/ui/jquery.ui.accordion.js +++ b/ui/jquery.ui.accordion.js @@ -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 |