]> source.dussan.org Git - jquery-ui.git/commitdiff
Buttonset: Ignore hidden buttons. Fixes #5946 - buttonset should ignore buttons that...
authorScott González <scott.gonzalez@gmail.com>
Wed, 18 Aug 2010 14:13:57 +0000 (10:13 -0400)
committerScott González <scott.gonzalez@gmail.com>
Wed, 18 Aug 2010 14:13:57 +0000 (10:13 -0400)
tests/unit/button/button_tickets.js
ui/jquery.ui.button.js

index 7f972513df615263f87c0aa24b3eafd8bb90d5ed..46002bdea7b9843e4519786694b3aecd81a319db 100644 (file)
@@ -5,6 +5,11 @@
 
 module("button: tickets");
 
-
+test("#5946 - buttonset should ignore buttons that are not :visible", function() {
+       $( "#radio01" ).next().wrap( "<div></div>" ).parent().hide();
+       var set = $( "#radio0" ).buttonset();
+       ok( set.find( "label:eq(0)" ).is( ".ui-button:not(.ui-corner-left)" ) );
+       ok( set.find( "label:eq(1)" ).is( ".ui-button.ui-corner-left" ) );
+});
 
 })(jQuery);
index b2fab4d2452dabd4c0f09c8aa5db55de8886ed4d..7d21fa495b950540e082e53e4bbe3fa1969af71b 100644 (file)
@@ -339,11 +339,13 @@ $.widget( "ui.buttonset", {
                                return $( this ).button( "widget" )[ 0 ];
                        })
                                .removeClass( "ui-corner-all ui-corner-left ui-corner-right" )
-                               .filter( ":first" )
-                                       .addClass( "ui-corner-left" )
-                               .end()
-                               .filter( ":last" )
-                                       .addClass( "ui-corner-right" )
+                               .filter( ":visible" )
+                                       .filter( ":first" )
+                                               .addClass( "ui-corner-left" )
+                                       .end()
+                                       .filter( ":last" )
+                                               .addClass( "ui-corner-right" )
+                                       .end()
                                .end()
                        .end();
        },