diff options
Diffstat (limited to 'tests/unit/autocomplete/autocomplete_options.js')
-rw-r--r-- | tests/unit/autocomplete/autocomplete_options.js | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/unit/autocomplete/autocomplete_options.js b/tests/unit/autocomplete/autocomplete_options.js index 2800fbab8..6ec4b69f2 100644 --- a/tests/unit/autocomplete/autocomplete_options.js +++ b/tests/unit/autocomplete/autocomplete_options.js @@ -97,6 +97,27 @@ test( "appendTo", function() { ac.autocomplete( "destroy" ); }); +function autoFocusTest( afValue, focusedLength ) { + var ac = $( "#autocomplete" ).autocomplete({ + autoFocus: afValue, + delay: 0, + source: data, + open: function( event, ui ) { + equal( ac.autocomplete( "widget" ).children( ".ui-menu-item:first .ui-state-hover" ).length, focusedLength, "first item is " + afValue ? "" : "not" + " auto focused" ); + start(); + } + }); + ac.val( "ja" ).keydown(); + stop(); +} + +test( "autoFocus: false", function() { + autoFocusTest( false, 0 ); +}); + +test( "autoFocus: true", function() { + autoFocusTest( true, 1 ); +}); test("delay", function() { var ac = $("#autocomplete").autocomplete({ |