diff options
author | Scott González <scott.gonzalez@gmail.com> | 2013-03-27 15:23:59 -0400 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2013-03-27 15:23:59 -0400 |
commit | 5a8596cdf3baa4d835e588cda9060a0537236c71 (patch) | |
tree | 6b3dd137d27f46c78d80f7b17bb8d1be9c1cabbc | |
parent | 2c43548ac629467596ee64d0c614a0cef3169852 (diff) | |
download | jquery-ui-5a8596cdf3baa4d835e588cda9060a0537236c71.tar.gz jquery-ui-5a8596cdf3baa4d835e588cda9060a0537236c71.zip |
Accordion: Maintain collapsed state on refresh. Fixes #9189 - Accordion: refresh() method incorrectly opens collapsed accordion.
-rw-r--r-- | tests/unit/accordion/accordion_methods.js | 11 | ||||
-rw-r--r-- | ui/jquery.ui.accordion.js | 2 |
2 files changed, 11 insertions, 2 deletions
diff --git a/tests/unit/accordion/accordion_methods.js b/tests/unit/accordion/accordion_methods.js index 7612479f7..1e809b310 100644 --- a/tests/unit/accordion/accordion_methods.js +++ b/tests/unit/accordion/accordion_methods.js @@ -35,7 +35,7 @@ test( "enable/disable", function() { }); test( "refresh", function() { - expect( 17 ); + expect( 19 ); var element = $( "#navigation" ) .parent() .height( 300 ) @@ -109,6 +109,15 @@ test( "refresh", function() { element.find( "div.foo" ).eq( 0 ).remove(); element.accordion( "refresh" ); state( element, 1 ); + + // collapse all panels + element.accordion( "option", { + collapsible: true, + active: false + }); + state( element, 0 ); + element.accordion( "refresh" ); + state( element, 0 ); }); test( "widget", function() { diff --git a/ui/jquery.ui.accordion.js b/ui/jquery.ui.accordion.js index c210a29a9..fc2b6bc57 100644 --- a/ui/jquery.ui.accordion.js +++ b/ui/jquery.ui.accordion.js @@ -223,7 +223,7 @@ $.widget( "ui.accordion", { options.active = false; this.active = $(); // active false only when collapsible is true - } if ( options.active === false ) { + } else if ( options.active === false ) { this._activate( 0 ); // was active, but active panel is gone } else if ( this.active.length && !$.contains( this.element[ 0 ], this.active[ 0 ] ) ) { |