Permalink
Browse files

Button tests: Handle async focus in IE.

  • Loading branch information...
1 parent 2841541 commit fbc7956b9fbbc14f7854588341177075282d56b5 @scottgonzalez scottgonzalez committed Dec 10, 2012
Showing with 20 additions and 7 deletions.
  1. +5 −2 tests/unit/button/button_core.js
  2. +15 −5 tests/unit/button/button_events.js
@@ -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" ) );
});
-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 );
var check = $( "#check" ).button(),
label = $( "label[for='check']" );
ok( !label.is( ".ui-state-focus" ) );
check.focus();
- ok( label.is( ".ui-state-focus" ) );
+ setTimeout(function() {
+ ok( label.is( ".ui-state-focus" ) );
+ start();
+ });
});
test( "#7534 - Button label selector works for ids with \":\"", function() {
@@ -13,14 +13,24 @@ test("buttonset works with single-quote named elements (#7505)", function() {
}).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 );
- $("#button").button().keypress( function() {
- $("#button").one( "blur", function() {
- ok( !$("#button").is(".ui-state-active"), "button loses active state appropriately" );
+ var element = $( "#button" ).button();
+
+ element.one( "keypress", function() {
+ element.one( "blur", function() {
+ ok( !element.is(".ui-state-active"), "button loses active state appropriately" );
+ start();
}).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);

0 comments on commit fbc7956

Please sign in to comment.