diff options
author | Mike Sherov <mike.sherov@gmail.com> | 2012-12-07 20:06:29 -0500 |
---|---|---|
committer | Mike Sherov <mike.sherov@gmail.com> | 2012-12-07 20:06:29 -0500 |
commit | e83a89dd7df3009d46ddd9e7e1cabf42e901e397 (patch) | |
tree | 8ada242bd81857ace993ce09625d06236530cc4a /tests/unit/dialog/dialog_core.js | |
parent | d4551bc3b8dfbfd925700dcb9f71e7729b125889 (diff) | |
download | jquery-ui-e83a89dd7df3009d46ddd9e7e1cabf42e901e397.tar.gz jquery-ui-e83a89dd7df3009d46ddd9e7e1cabf42e901e397.zip |
Dev: Remove *_tickets.js test files and move the associated tests to the proper locations.
Diffstat (limited to 'tests/unit/dialog/dialog_core.js')
-rw-r--r-- | tests/unit/dialog/dialog_core.js | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/tests/unit/dialog/dialog_core.js b/tests/unit/dialog/dialog_core.js index 9c0e80825..700208dfc 100644 --- a/tests/unit/dialog/dialog_core.js +++ b/tests/unit/dialog/dialog_core.js @@ -80,8 +80,7 @@ test( "focus tabbable", function() { }, 13); }); -// #7960 -test( "resizable handles below modal overlays", function() { +test( "#7960: resizable handles below modal overlays", function() { expect( 1 ); var resizable = $( "<div>" ).resizable(), @@ -93,4 +92,33 @@ test( "resizable handles below modal overlays", function() { dialog.dialog( "destroy" ); }); +asyncTest( "#3123: Prevent tabbing out of modal dialogs", function() { + expect( 3 ); + + var el = $( "<div><input id='t3123-first'><input id='t3123-last'></div>" ).dialog({ modal: true }), + inputs = el.find( "input" ), + widget = el.dialog( "widget" )[ 0 ]; + + function checkTab() { + ok( $.contains( widget, document.activeElement ), "Tab key event moved focus within the modal" ); + + // check shift tab + $( document.activeElement ).simulate( "keydown", { keyCode: $.ui.keyCode.TAB, shiftKey: true }); + setTimeout( checkShiftTab, 2 ); + } + + function checkShiftTab() { + ok( $.contains( widget, document.activeElement ), "Shift-Tab key event moved focus within the modal" ); + + el.remove(); + start(); + } + + inputs.eq( 1 ).focus(); + equal( document.activeElement, inputs[1], "Focus set on second input" ); + inputs.eq( 1 ).simulate( "keydown", { keyCode: $.ui.keyCode.TAB }); + + setTimeout( checkTab, 2 ); +}); + })(jQuery); |