mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Buttonset: Added items option and removed visible filter for adding rounded corners. Fixes #6262 - buttonset not applying ui-corner to invisible elements.
This commit is contained in:
parent
fce1f97f76
commit
5dad57e3c2
@ -1,15 +1,23 @@
|
|||||||
/*
|
/*
|
||||||
* button_tickets.js
|
* button_tickets.js
|
||||||
*/
|
*/
|
||||||
(function($) {
|
(function( $ ) {
|
||||||
|
|
||||||
module("button: tickets");
|
module( "button: tickets" );
|
||||||
|
|
||||||
test("#5946 - buttonset should ignore buttons that are not :visible", function() {
|
test( "#5946 - buttonset should ignore buttons that are not :visible", function() {
|
||||||
$( "#radio01" ).next().wrap( "<div></div>" ).parent().hide();
|
$( "#radio01" ).next().andSelf().hide();
|
||||||
var set = $( "#radio0" ).buttonset();
|
var set = $( "#radio0" ).buttonset({ items: ":radio:visible" });
|
||||||
ok( set.find( "label:eq(0)" ).is( ".ui-button:not(.ui-corner-left)" ) );
|
ok( set.find( "label:eq(0)" ).is( ":not(.ui-button):not(.ui-corner-left)" ) );
|
||||||
ok( set.find( "label:eq(1)" ).is( ".ui-button.ui-corner-left" ) );
|
ok( set.find( "label:eq(1)" ).is( ".ui-button.ui-corner-left" ) );
|
||||||
});
|
});
|
||||||
|
|
||||||
})(jQuery);
|
test( "#6262 - buttonset not applying ui-corner to invisible elements", function() {
|
||||||
|
$( "#radio0" ).hide();
|
||||||
|
var set = $( "#radio0" ).buttonset();
|
||||||
|
ok( set.find( "label:eq(0)" ).is( ".ui-button.ui-corner-left" ) );
|
||||||
|
ok( set.find( "label:eq(1)" ).is( ".ui-button" ) );
|
||||||
|
ok( set.find( "label:eq(2)" ).is( ".ui-button.ui-corner-right" ) );
|
||||||
|
});
|
||||||
|
|
||||||
|
})( jQuery );
|
||||||
|
18
ui/jquery.ui.button.js
vendored
18
ui/jquery.ui.button.js
vendored
@ -315,6 +315,10 @@ $.widget( "ui.button", {
|
|||||||
});
|
});
|
||||||
|
|
||||||
$.widget( "ui.buttonset", {
|
$.widget( "ui.buttonset", {
|
||||||
|
options: {
|
||||||
|
items: ":button, :submit, :reset, :checkbox, :radio, a, :data(button)"
|
||||||
|
},
|
||||||
|
|
||||||
_create: function() {
|
_create: function() {
|
||||||
this.element.addClass( "ui-buttonset" );
|
this.element.addClass( "ui-buttonset" );
|
||||||
},
|
},
|
||||||
@ -332,7 +336,7 @@ $.widget( "ui.buttonset", {
|
|||||||
},
|
},
|
||||||
|
|
||||||
refresh: function() {
|
refresh: function() {
|
||||||
this.buttons = this.element.find( ":button, :submit, :reset, :checkbox, :radio, a, :data(button)" )
|
this.buttons = this.element.find( this.options.items )
|
||||||
.filter( ":ui-button" )
|
.filter( ":ui-button" )
|
||||||
.button( "refresh" )
|
.button( "refresh" )
|
||||||
.end()
|
.end()
|
||||||
@ -343,13 +347,11 @@ $.widget( "ui.buttonset", {
|
|||||||
return $( this ).button( "widget" )[ 0 ];
|
return $( this ).button( "widget" )[ 0 ];
|
||||||
})
|
})
|
||||||
.removeClass( "ui-corner-all ui-corner-left ui-corner-right" )
|
.removeClass( "ui-corner-all ui-corner-left ui-corner-right" )
|
||||||
.filter( ":visible" )
|
.filter( ":first" )
|
||||||
.filter( ":first" )
|
.addClass( "ui-corner-left" )
|
||||||
.addClass( "ui-corner-left" )
|
.end()
|
||||||
.end()
|
.filter( ":last" )
|
||||||
.filter( ":last" )
|
.addClass( "ui-corner-right" )
|
||||||
.addClass( "ui-corner-right" )
|
|
||||||
.end()
|
|
||||||
.end()
|
.end()
|
||||||
.end();
|
.end();
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user