2014-08-28 19:16:51 +00:00
|
|
|
define( [
|
|
|
|
"jquery",
|
2015-01-08 02:51:38 +00:00
|
|
|
"ui/widgets/checkboxradio"
|
2014-08-28 19:16:51 +00:00
|
|
|
], function( $ ) {
|
|
|
|
|
|
|
|
module( "Checkboxradio: events" );
|
|
|
|
|
|
|
|
asyncTest(
|
|
|
|
"Resetting a checkbox's form should refresh the visual state of the checkbox",
|
|
|
|
function( assert ) {
|
|
|
|
expect( 2 );
|
|
|
|
var form = $( "<form>" +
|
|
|
|
"<label for='c1'></label><input id='c1' type='checkbox' checked>" +
|
|
|
|
"</form>" ),
|
|
|
|
checkbox = form.find( "input[type=checkbox]" ).checkboxradio(),
|
|
|
|
widget = checkbox.checkboxradio( "widget" );
|
|
|
|
|
|
|
|
checkbox.prop( "checked", false ).checkboxradio( "refresh" );
|
|
|
|
assert.lacksClasses( widget, "ui-state-active" );
|
|
|
|
|
|
|
|
form.get( 0 ).reset();
|
|
|
|
|
2015-09-11 14:48:20 +00:00
|
|
|
setTimeout( function() {
|
2014-08-28 19:16:51 +00:00
|
|
|
assert.hasClasses( widget, "ui-state-active" );
|
|
|
|
start();
|
|
|
|
}, 1 );
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
|
|
|
asyncTest( "Checkbox shows focus when using keyboard navigation", function( assert ) {
|
|
|
|
expect( 2 );
|
|
|
|
var check = $( "#check" ).checkboxradio(),
|
|
|
|
label = $( "label[for='check']" );
|
|
|
|
assert.lacksClasses( label, "ui-state-focus" );
|
|
|
|
check.focus();
|
2015-09-11 14:48:20 +00:00
|
|
|
setTimeout( function() {
|
2014-08-28 19:16:51 +00:00
|
|
|
assert.hasClasses( label, "ui-state-focus" );
|
|
|
|
start();
|
|
|
|
} );
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
|
|
|
} );
|