}
});
+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 ) );