Button tests: Handle async focus in IE.

This commit is contained in:
Scott González 2012-12-10 10:35:01 -05:00
parent 2841541362
commit fbc7956b9f
2 changed files with 20 additions and 7 deletions

View File

@ -153,13 +153,16 @@ test( "#6262 - buttonset not applying ui-corner to invisible elements", function
ok( set.find( "label:eq(2)" ).is( ".ui-button.ui-corner-right" ) ); ok( set.find( "label:eq(2)" ).is( ".ui-button.ui-corner-right" ) );
}); });
test( "#6711 Checkbox/Radiobutton do not Show Focused State when using Keyboard Navigation", function() { asyncTest( "#6711 Checkbox/Radiobutton do not Show Focused State when using Keyboard Navigation", function() {
expect( 2 ); expect( 2 );
var check = $( "#check" ).button(), var check = $( "#check" ).button(),
label = $( "label[for='check']" ); label = $( "label[for='check']" );
ok( !label.is( ".ui-state-focus" ) ); ok( !label.is( ".ui-state-focus" ) );
check.focus(); check.focus();
setTimeout(function() {
ok( label.is( ".ui-state-focus" ) ); ok( label.is( ".ui-state-focus" ) );
start();
});
}); });
test( "#7534 - Button label selector works for ids with \":\"", function() { test( "#7534 - Button label selector works for ids with \":\"", function() {

View File

@ -13,14 +13,24 @@ test("buttonset works with single-quote named elements (#7505)", function() {
}).click(); }).click();
}); });
test( "when button loses focus, ensure active state is removed (#8559)", function() { asyncTest( "when button loses focus, ensure active state is removed (#8559)", function() {
expect( 1 ); expect( 1 );
$("#button").button().keypress( function() { var element = $( "#button" ).button();
$("#button").one( "blur", function() {
ok( !$("#button").is(".ui-state-active"), "button loses active state appropriately" ); element.one( "keypress", function() {
element.one( "blur", function() {
ok( !element.is(".ui-state-active"), "button loses active state appropriately" );
start();
}).blur(); }).blur();
}).focus().simulate( "keydown", { keyCode: $.ui.keyCode.ENTER } ).simulate( "keypress", { keyCode: $.ui.keyCode.ENTER } ); });
element.focus();
setTimeout(function() {
element
.simulate( "keydown", { keyCode: $.ui.keyCode.ENTER } )
.simulate( "keypress", { keyCode: $.ui.keyCode.ENTER } );
});
}); });
})(jQuery); })(jQuery);