diff options
author | TJ VanToll <tj.vantoll@gmail.com> | 2014-10-02 17:15:07 -0400 |
---|---|---|
committer | TJ VanToll <tj.vantoll@gmail.com> | 2014-10-03 09:30:49 -0400 |
commit | 6b6b49f678706280c5590a5097ef9f0aca359d4b (patch) | |
tree | 14436a911eb612afbe70147566f0cf4e142bc33f /tests/unit/menu/menu_events.js | |
parent | e3e5a9ffa647937d2dd458114e27e04f56bd47d0 (diff) | |
download | jquery-ui-6b6b49f678706280c5590a5097ef9f0aca359d4b.tar.gz jquery-ui-6b6b49f678706280c5590a5097ef9f0aca359d4b.zip |
Menu: Maintain focus on already selected item during typeahead
Fixes #10644
Closes gh-1354
Diffstat (limited to 'tests/unit/menu/menu_events.js')
-rw-r--r-- | tests/unit/menu/menu_events.js | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/unit/menu/menu_events.js b/tests/unit/menu/menu_events.js index 0a02cc01b..ff7eb4c7c 100644 --- a/tests/unit/menu/menu_events.js +++ b/tests/unit/menu/menu_events.js @@ -629,6 +629,28 @@ asyncTest( "handle keyboard navigation with spelling of menu items", function() element[ 0 ].focus(); }); +asyncTest( "Keep focus on selected item (see #10644)", function() { + expect( 1 ); + var element = $( "#menu2" ).menu({ + focus: function( event ) { + log( $( event.target ).find( ".ui-state-focus" ).index() ); + } + }); + + log( "keydown", true ); + element.one( "menufocus", function() { + element.simulate( "keydown", { keyCode: 65 } ); + element.simulate( "keydown", { keyCode: 68 } ); + element.simulate( "keydown", { keyCode: 68 } ); + element.simulate( "keydown", { keyCode: 89 } ); + element.simulate( "keydown", { keyCode: 83 } ); + equal( logOutput(), "keydown,0,1,3,3,3", + "Focus stays on 'Addyston', even after other options are eliminated" ); + start(); + }); + element[ 0 ].focus(); +}); + test( "#9469: Stopping propagation in a select event should not suppress subsequent select events.", function() { expect( 1 ); var element = $( "#menu1" ).menu({ |