diff options
author | Felix Nagel <info@felixnagel.com> | 2012-05-24 18:34:32 +0200 |
---|---|---|
committer | Felix Nagel <info@felixnagel.com> | 2012-05-24 18:34:32 +0200 |
commit | b30184d885329317b9dbd70835d2c4d154f98475 (patch) | |
tree | 445acc2481e8456211c3e893e7789fe4b5978791 /tests/unit/autocomplete/autocomplete_core.js | |
parent | ec6d88fae464ffb432df6c8d2ed06ee9fa5b4dae (diff) | |
parent | a1f604eb453208c80ec17c42c7bb4e3a1c624102 (diff) | |
download | jquery-ui-b30184d885329317b9dbd70835d2c4d154f98475.tar.gz jquery-ui-b30184d885329317b9dbd70835d2c4d154f98475.zip |
Merge with master
Diffstat (limited to 'tests/unit/autocomplete/autocomplete_core.js')
-rw-r--r-- | tests/unit/autocomplete/autocomplete_core.js | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/unit/autocomplete/autocomplete_core.js b/tests/unit/autocomplete/autocomplete_core.js index daeea0972..f0ad36a57 100644 --- a/tests/unit/autocomplete/autocomplete_core.js +++ b/tests/unit/autocomplete/autocomplete_core.js @@ -152,4 +152,41 @@ asyncTest( "handle race condition", function() { } }); +test( "ARIA", function() { + expect( 7 ); + var element = $( "#autocomplete" ).autocomplete({ + source: [ "java", "javascript" ] + }), + liveRegion = element.data( "ui-autocomplete" ).liveRegion; + + equal( liveRegion.text(), "", "Empty live region on create" ); + + element.autocomplete( "search", "j" ); + equal( liveRegion.text(), "2 results are available, use up and down arrow keys to navigate.", + "Live region for multiple values" ); + + element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } ); + equal( liveRegion.text(), "2 results are available, use up and down arrow keys to navigate.", + "Live region not changed on focus" ); + + element.one( "autocompletefocus", function( event ) { + event.preventDefault(); + }); + element.simulate( "keydown", { keyCode: $.ui.keyCode.DOWN } ); + equal( liveRegion.text(), "javascript", + "Live region updated when default focus is prevented" ); + + element.autocomplete( "search", "javas" ); + equal( liveRegion.text(), "1 result is available, use up and down arrow keys to navigate.", + "Live region for one value" ); + + element.autocomplete( "search", "z" ); + equal( liveRegion.text(), "No search results.", + "Live region for no values" ); + + element.autocomplete( "search", "j" ); + equal( liveRegion.text(), "2 results are available, use up and down arrow keys to navigate.", + "Live region for multiple values" ); +}); + }( jQuery ) ); |