aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit/button
diff options
context:
space:
mode:
authorScott González <scott.gonzalez@gmail.com>2012-12-10 10:35:01 -0500
committerScott González <scott.gonzalez@gmail.com>2012-12-10 10:35:01 -0500
commitfbc7956b9fbbc14f7854588341177075282d56b5 (patch)
tree5ce0aea7d7984504f9932502fca33fe87f9d0ae1 /tests/unit/button
parent2841541362fe121977181888c3181676f0b796e4 (diff)
downloadjquery-ui-fbc7956b9fbbc14f7854588341177075282d56b5.tar.gz
jquery-ui-fbc7956b9fbbc14f7854588341177075282d56b5.zip
Button tests: Handle async focus in IE.
Diffstat (limited to 'tests/unit/button')
-rw-r--r--tests/unit/button/button_core.js7
-rw-r--r--tests/unit/button/button_events.js20
2 files changed, 20 insertions, 7 deletions
diff --git a/tests/unit/button/button_core.js b/tests/unit/button/button_core.js
index 460201f15..6d0bbbe88 100644
--- a/tests/unit/button/button_core.js
+++ b/tests/unit/button/button_core.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() {
diff --git a/tests/unit/button/button_events.js b/tests/unit/button/button_events.js
index 7b79c41ea..2fd038325 100644
--- a/tests/unit/button/button_events.js
+++ b/tests/unit/button/button_events.js
@@ -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);