Skip to content
Permalink
Browse files

Checkboxradio: Style updates

  • Loading branch information...
arschmitz committed Sep 11, 2015
1 parent 6169099 commit 641c5ed17a302bcc7cdf395461efdfa12640fcbf
@@ -17,6 +17,6 @@ common.testWidget( "checkboxradio", {
// Callbacks
create: null
}
});
} );

} );
@@ -6,13 +6,13 @@ define( [
module( "Checkboxradio: core" );
test( "Checkbox - Initial class structure", function( assert ) {
expect( 2 );
var input = $("#check"),
label = $("label[for=check]");
var input = $( "#check" ),
label = $( "label[for=check]" );

input.checkboxradio();
assert.hasClasses( input, "ui-helper-hidden-accessible ui-checkboxradio" );
assert.hasClasses( label, "ui-button ui-widget ui-checkboxradio-label ui-corner-all" );
});
} );

test( "Radios - Initial class structure", function( assert ) {
expect( 6 );
@@ -22,11 +22,11 @@ test( "Radios - Initial class structure", function( assert ) {
inputs.checkboxradio();
inputs.each( function() {
assert.hasClasses( this, "ui-helper-hidden-accessible" );
});
} );
labels.each( function() {
assert.hasClasses( this, "ui-button" );
});
});
} );
} );

asyncTest( "Ensure checked after single click on checkbox label button", function( assert ) {
expect( 2 );
@@ -36,17 +36,17 @@ asyncTest( "Ensure checked after single click on checkbox label button", functio
ok( this.checked, "checked ok" );

assert.hasClasses( label, "ui-state-active" );
});
} );

// Support: Opera
// Opera doesn't trigger a change event when this is done synchronously.
// This seems to be a side effect of another test, but until that can be
// tracked down, this delay will have to do.
setTimeout(function() {
setTimeout( function() {
$( "#check2" ).checkboxradio( "widget" ).simulate( "click" );
start();
});
});
} );
} );

test( "Checkbox creation requires a label, and finds it in all cases", function( assert ) {
expect( 7 );
@@ -66,7 +66,7 @@ test( "Checkbox creation requires a label, and finds it in all cases", function(
group.find( "input[type=checkbox]" ).checkboxradio();
assert.hasClasses( group.find( "label" ), "ui-button" );
} );
});
} );

test( "Calling checkboxradio on an unsupported element throws an error", function( assert ) {
expect( 2 );
@@ -86,7 +86,7 @@ test( "Calling checkboxradio on an unsupported element throws an error", functio
error,
"Proper error thrown"
);
});
} );
test( "Calling checkboxradio on an input with no label throws an error", function( assert ) {
expect( 1 );
var error = new Error( "No label found for checkboxradio widget" );
@@ -97,6 +97,6 @@ test( "Calling checkboxradio on an input with no label throws an error", functio
error,
"Proper error thrown"
);
});
} );

} );
@@ -20,7 +20,7 @@ asyncTest(

form.get( 0 ).reset();

setTimeout(function() {
setTimeout( function() {
assert.hasClasses( widget, "ui-state-active" );
start();
}, 1 );
@@ -33,7 +33,7 @@ asyncTest( "Checkbox shows focus when using keyboard navigation", function( asse
label = $( "label[for='check']" );
assert.lacksClasses( label, "ui-state-focus" );
check.focus();
setTimeout(function() {
setTimeout( function() {
assert.hasClasses( label, "ui-state-focus" );
start();
} );
@@ -46,14 +46,14 @@ $.each( [ "checkbox", "radio" ], function( index, value ) {
assert.lacksClasses( icon, "ui-icon-check" );
}
assert.lacksClasses( widget, "ui-checkboxradio-checked" );
});
} );

test( value + ": destroy", function( assert ){
test( value + ": destroy", function( assert ) {
expect( 1 );
assert.domEqual( "#" + value + "-method-destroy", function() {
$( "#" + value + "-method-destroy" ).checkboxradio().checkboxradio( "destroy" );
});
});
} );
} );

test( value + ": disable / enable", function( assert ) {
expect( 4 );
@@ -69,9 +69,9 @@ $.each( [ "checkbox", "radio" ], function( index, value ) {
assert.lacksClasses( widget, "ui-state-disabled" );
strictEqual( input.is( ":disabled" ), false,
value + " has disabled prop removed when enable is called" );
});
} );

test( value + ": widget returns the label", function(){
test( value + ": widget returns the label", function() {
var input = $( "#" + value + "-method-refresh" ),
label = $( "#" + value + "-method-refresh-label" );

@@ -80,7 +80,7 @@ $.each( [ "checkbox", "radio" ], function( index, value ) {
input.checkboxradio();
strictEqual( input.checkboxradio( "widget" )[ 0 ], label[ 0 ],
"widget method returns label" );
});
} );

} );

@@ -92,6 +92,6 @@ test( "Input wrapped in a label preserved on refresh", function() {

input.checkboxradio( "refresh" );
strictEqual( input.parent()[ 0 ], element[ 0 ], "Input preserved" );
});
} );

} );
@@ -22,9 +22,9 @@ function assertEnabled( checkbox, assert ) {
test( "disabled", function( assert ) {
var checkbox = $( "#checkbox-option-disabled" );
expect( 6 );
checkbox.checkboxradio({
checkbox.checkboxradio( {
disabled: true
});
} );

assertDisabled( checkbox, assert );

@@ -33,7 +33,7 @@ test( "disabled", function( assert ) {

checkbox.checkboxradio( "option", "disabled", true );
assertDisabled( checkbox, assert );
});
} );
test( "disabled - prop true on init", function( assert ) {
expect( 2 );
var checkbox = $( "#checkbox-option-disabled" );
@@ -42,17 +42,17 @@ test( "disabled - prop true on init", function( assert ) {
checkbox.checkboxradio();

assertDisabled( checkbox, assert );
});
} );
test( "disabled - explicit null value, checks the DOM", function( assert ) {
expect( 2 );
var checkbox = $( "#checkbox-option-disabled" );

checkbox.prop( "disabled", true );
checkbox.checkboxradio({
checkbox.checkboxradio( {
disabled: null
});
} );
assertDisabled( checkbox, assert );
});
} );

function assertNoIcon( checkbox ) {
strictEqual( checkbox.checkboxradio( "widget" ).find( "span.ui-icon" ).length, 0,
@@ -73,9 +73,9 @@ test( "icon - false on init", function() {

expect( 1 );

checkbox.checkboxradio({ icon: false });
checkbox.checkboxradio( { icon: false } );
assertNoIcon( checkbox );
});
} );

test( "icon - default unchecked", function( assert ) {
var checkbox = $( "#checkbox-option-icon" );
@@ -84,8 +84,8 @@ test( "icon - default unchecked", function( assert ) {

checkbox.checkboxradio();
assertIcon( checkbox, false, assert );
});
test( "icon", function( assert ){
} );
test( "icon", function( assert ) {
var checkbox = $( "#checkbox-option-icon" );

expect( 8 );
@@ -108,7 +108,7 @@ test( "icon", function( assert ){
checkbox.checkboxradio( "option", "icon", true );
assertIcon( checkbox, false, assert );

});
} );

test( "label - default", function() {
var checkbox = $( "#checkbox-option-label" ),
@@ -122,12 +122,12 @@ test( "label - default", function() {
"checkbox label", "When no value passed on create text from dom is used for option" );
strictEqual( widget.text(),
" checkbox label", "When no value passed on create text from dom is used in dom" );
});
} );
test( "label - explicit value", function() {
expect( 5 );
var checkbox = $( "#checkbox-option-label" ).checkboxradio({
var checkbox = $( "#checkbox-option-label" ).checkboxradio( {
label: "foo"
}),
} ),
widget = checkbox.checkboxradio( "widget" ),
icon = widget.find( ".ui-icon" ),
iconSpace = widget.find( ".ui-checkboxradio-icon-space" );
@@ -142,7 +142,7 @@ test( "label - explicit value", function() {
"Icon space is preserved when label is set on init when wrapped in label" );
strictEqual( $( "#checkbox-option-label" ).length, 1,
"Element is preserved when label is set on init when wrapped in label" );
});
} );

test( "label - explicit null value", function() {
var checkbox = $( "#checkbox-option-label" ),
@@ -153,16 +153,16 @@ test( "label - explicit null value", function() {
// We are testing the default here because the default null is a special value which means to check
// the DOM, so we need to make sure this happens correctly checking the options should never return
// null. It should always be true or false
checkbox.checkboxradio({
checkbox.checkboxradio( {
label: null
});
} );
widget = checkbox.checkboxradio( "widget" );
strictEqual( checkbox.checkboxradio( "option", "label" ),
"checkbox label", "When null is passed on create text from dom is used for option" );
strictEqual( widget.text(),
" checkbox label", "When null is passed on create text from dom is used in dom" );

});
} );

test( "label", function() {
var checkbox = $( "#checkbox-option-label" ),
@@ -184,6 +184,6 @@ test( "label", function() {
strictEqual( widget.text(),
" bar", "When null is passed text from dom is used in dom" );

});
} );

} );

0 comments on commit 641c5ed

Please sign in to comment.
You can’t perform that action at this time.