diff options
author | kborchers <kris.borchers@gmail.com> | 2012-02-06 15:01:40 -0600 |
---|---|---|
committer | kborchers <kris.borchers@gmail.com> | 2012-02-06 15:01:40 -0600 |
commit | 3ef4db267040844d7a36165c9fa72e77e9118429 (patch) | |
tree | 446695baaaf37fb4ed249d65bf3402b585c5eb4a | |
parent | b968ac32a181cd329095f1a2a60a786b0d5728c9 (diff) | |
download | jquery-ui-3ef4db267040844d7a36165c9fa72e77e9118429.tar.gz jquery-ui-3ef4db267040844d7a36165c9fa72e77e9118429.zip |
Menu: Focus the menu before performing keyboard unit tests.
-rw-r--r-- | tests/unit/menu/menu_events.js | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/tests/unit/menu/menu_events.js b/tests/unit/menu/menu_events.js index 8df43fa21..3a3e6b47f 100644 --- a/tests/unit/menu/menu_events.js +++ b/tests/unit/menu/menu_events.js @@ -144,13 +144,14 @@ test("handle keyboard navigation on menu without scroll and without submenus", f }); menu_log("keydown",true); + element.focus(); element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } ); element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } ); - equals( $("#log").html(), "1,0,keydown,", "Keydown DOWN"); + equals( $("#log").html(), "2,1,0,keydown,", "Keydown DOWN"); menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.UP } ); - equals( $("#log").html(), "0,keydown,", "Keydown UP"); + equals( $("#log").html(), "1,keydown,", "Keydown UP"); menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.LEFT } ); @@ -205,13 +206,15 @@ asyncTest("handle keyboard navigation on menu without scroll and with submenus", }); menu_log("keydown",true); + element.focus(); element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } ); element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } ); - equals( $("#log").html(), "1,0,keydown,", "Keydown DOWN"); + equals( $("#log").html(), "2,1,0,keydown,", "Keydown DOWN"); menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.UP } ); - equals( $("#log").html(), "0,keydown,", "Keydown UP"); + element.simulate( "keydown", { keyCode: $.ui.keyCode.UP } ); + equals( $("#log").html(), "0,1,keydown,", "Keydown UP"); menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.LEFT } ); @@ -294,13 +297,15 @@ test("handle keyboard navigation on menu with scroll and without submenus", func }); menu_log("keydown",true); + element.focus(); element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } ); element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } ); - equals( $("#log").html(), "1,0,keydown,", "Keydown DOWN"); + equals( $("#log").html(), "2,1,0,keydown,", "Keydown DOWN"); menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.UP } ); - equals( $("#log").html(), "0,keydown,", "Keydown UP"); + element.simulate( "keydown", { keyCode: $.ui.keyCode.UP } ); + equals( $("#log").html(), "0,1,keydown,", "Keydown UP"); menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.LEFT } ); @@ -363,13 +368,15 @@ asyncTest("handle keyboard navigation on menu with scroll and with submenus", fu }); menu_log("keydown",true); + element.focus(); element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } ); element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } ); - equals( $("#log").html(), "1,0,keydown,", "Keydown DOWN"); + equals( $("#log").html(), "2,1,0,keydown,", "Keydown DOWN"); menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.UP } ); - equals( $("#log").html(), "0,keydown,", "Keydown UP"); + element.simulate( "keydown", { keyCode: $.ui.keyCode.UP } ); + equals( $("#log").html(), "0,1,keydown,", "Keydown UP"); menu_log("keydown",true); element.simulate( "keydown", { keyCode: $.ui.keyCode.LEFT } ); |