Skip to content

Commit d566fec

Browse files
committed
Button: Update css based on pr comments
1 parent 1e225e7 commit d566fec

File tree

5 files changed

+26
-17
lines changed

5 files changed

+26
-17
lines changed

tests/unit/checkboxradio/checkboxradio_common.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ TestHelpers.commonWidgetTests( "checkboxradio", {
33
disabled: null,
44
label: null,
55
icon: null,
6-
// callbacks
6+
7+
// Callbacks
78
create: null
89
}
910
});

tests/unit/checkboxradio/checkboxradio_core.js

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,38 +52,41 @@ test("radio groups", function() {
5252
assert(":eq(1)", ":eq(0)", ":eq(0)");
5353
});
5454

55-
asyncTest( "#6711 Checkbox/Radiobutton do not Show Focused State when using Keyboard Navigation", function() {
55+
asyncTest( "Checkbox/Radiobutton do not Show Focused State when using Keyboard Navigation", function() {
5656
expect( 2 );
5757
var check = $( "#check" ).checkboxradio(),
5858
label = $( "label[for='check']" );
59-
ok( !label.is( ".ui-state-focus" ) );
59+
( !label.is( ".ui-state-focus" ) );
6060
check.focus();
6161
setTimeout(function() {
6262
ok( label.is( ".ui-state-focus" ) );
6363
start();
6464
});
6565
});
66+
ok( slider.hasClass( "ui-state-disabled" ), "disabling a slider should also disable the input " );
67+
6668
// TODO: simulated click events don't behave like real click events in IE
6769
// remove this when simulate properly simulates this
6870
// see http://yuilibrary.com/projects/yui2/ticket/2528826 fore more info
6971
if ( !$.ui.ie || ( document.documentMode && document.documentMode > 8 ) ) {
7072
asyncTest( "ensure checked and aria after single click on checkbox label button, see #5518", function() {
7173
expect( 2 );
7274

73-
$("#check2").checkboxradio().change( function() {
74-
var lbl = $( this ).checkboxradio("widget");
75+
$( "#check2" ).checkboxradio().change( function() {
76+
var label = $( this ).checkboxradio( "widget" );
7577
ok( this.checked, "checked ok" );
78+
7679
// The following test is commented out for now because with new markup we are trying to avoid aria
7780
//ok( lbl.attr("aria-pressed") === "true", "aria ok" );
78-
ok( lbl.hasClass("ui-state-active"), "ui-state-active ok" );
81+
ok( label.hasClass( "ui-state-active" ), "ui-state-active ok" );
7982
});
8083

81-
// support: Opera
84+
// Support: Opera
8285
// Opera doesn't trigger a change event when this is done synchronously.
8386
// This seems to be a side effect of another test, but until that can be
8487
// tracked down, this delay will have to do.
8588
setTimeout(function() {
86-
$("#check2").checkboxradio("widget").simulate("click");
89+
$( "#check2" ).checkboxradio( "widget" ).simulate( "click" );
8790
start();
8891
}, 1 );
8992
});

themes/base/button.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
text-align: center;
2020
overflow: visible; /* removes extra width in IE */
2121
}
22+
2223
.ui-button,
2324
.ui-button:link,
2425
.ui-button:visited,
@@ -34,6 +35,10 @@
3435
text-indent: -9999px;
3536
white-space: nowrap;
3637
}
38+
.ui-button .ui-icon {
39+
position: absolute;
40+
display: block;
41+
}
3742
/* button elements seem to need a little more width */
3843
button.ui-button-icon-only {
3944
width: 2.4em;

themes/base/checkboxradio.css

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@
99
* http://api.jqueryui.com/checkboxradio/#theming
1010
*/
1111

12-
.ui-checkbox{
13-
display:none;
12+
.ui-checkbox {
13+
display: none;
1414
}
15-
span.ui-icon-background{
15+
.ui-checkbox-label .ui-icon-background {
1616
border-radius: .12em;
1717
border: none;
1818
}
19-
.ui-radio-label .ui-icon.ui-icon-background{
19+
.ui-radio-label .ui-icon.ui-icon-background {
2020
width: 16px;
2121
height: 16px;
2222
border-radius: 1em;
@@ -25,8 +25,8 @@ span.ui-icon-background{
2525
background-color: rgba( 0, 0, 0, .3 );
2626
opacity: .3;
2727
}
28-
label.ui-radio-label.ui-radio-checked .ui-icon,
29-
label.ui-radio-label.ui-radio-checked:hover .ui-icon{
28+
.ui-radio-label.ui-radio-checked .ui-icon,
29+
.ui-radio-label.ui-radio-checked:hover .ui-icon {
3030
background-image: none;
3131
background-color: #fff;
3232
width: 8px;

ui/checkboxradio.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ $.widget( "ui.checkboxradio", {
9393
this.label.addClass( baseClasses + " ui-" + this.type + "-label" );
9494

9595
if ( this.options.icon ) {
96-
this.label.addClass( "ui-icon-begining" );
96+
this.label.addClass( "ui-icon-beginning" );
9797
this.icon = $( "<span>" );
9898
if ( this.element.is( ":checked" ) && this.type === "checkbox" ){
9999
this.icon.addClass( "ui-icon ui-icon-background ui-corner-all ui-icon-check" );
@@ -192,7 +192,7 @@ $.widget( "ui.checkboxradio", {
192192
_setClasses: function() {
193193
var checked = this.element.is( ":checked" );
194194
if ( this.options.icon === true ){
195-
this.label.addClass( "ui-icon-begining" );
195+
this.label.addClass( "ui-icon-beginning" );
196196
if ( this.icon === undefined ) {
197197
this.icon = $( "<span>" );
198198
this.label.prepend( this.icon );
@@ -203,7 +203,7 @@ $.widget( "ui.checkboxradio", {
203203
this.icon.addClass( "ui-icon ui-icon-background ui-corner-all ui-icon-blank" );
204204
}
205205
} else if ( this.icon !== undefined ) {
206-
this.label.removeClass( "ui-icon-begining" );
206+
this.label.removeClass( "ui-icon-beginning" );
207207
this.icon.remove();
208208
delete this.icon;
209209
}

0 commit comments

Comments
 (0)