]> source.dussan.org Git - jquery-ui.git/commitdiff
Accordion: Maintain collapsed state on refresh. Fixes #9189 - Accordion: refresh...
authorScott González <scott.gonzalez@gmail.com>
Wed, 27 Mar 2013 19:23:59 +0000 (15:23 -0400)
committerScott González <scott.gonzalez@gmail.com>
Wed, 17 Apr 2013 18:57:09 +0000 (14:57 -0400)
(cherry picked from commit 5a8596cdf3baa4d835e588cda9060a0537236c71)

tests/unit/accordion/accordion_methods.js
ui/jquery.ui.accordion.js

index b1123b8284701b82b55803d4d2ae3bdc8783428f..f81bd6ded6a6b311de194d68874af0ca8e5c9eda 100644 (file)
@@ -30,7 +30,7 @@ test( "enable/disable", function() {
 });
 
 test( "refresh", function() {
-       expect( 17 );
+       expect( 19 );
        var element = $( "#navigation" )
                .parent()
                        .height( 300 )
@@ -104,6 +104,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() {
index 1afa95cb4b0071108280dea8846a287c2db7c4af..01fe2c01473db8cfb301cd01ee66f4e1003afd90 100644 (file)
@@ -221,7 +221,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 ] ) ) {