mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-10-05 01:44:18 +00:00
Autocomplete: added unit tests for autoFocus. Fixed #7032 - Autocomplete: Add option to automatically highlight the first result
(cherry picked from commit 56b7ec134d
)
This commit is contained in:
parent
779df6517d
commit
218100e704
@ -97,6 +97,33 @@ test( "appendTo", function() {
|
|||||||
ac.autocomplete( "destroy" );
|
ac.autocomplete( "destroy" );
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test( "autoFocus: false", function() {
|
||||||
|
var ac = $( "#autocomplete" ).autocomplete({
|
||||||
|
autoFocus: false,
|
||||||
|
delay: 0,
|
||||||
|
source: data,
|
||||||
|
open: function( event, ui ) {
|
||||||
|
equals( 0, ac.autocomplete( "widget" ).children( ".ui-menu-item:first .ui-state-focus" ).length, "first item is not auto focused" );
|
||||||
|
start();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
ac.val( "ja" ).keydown();
|
||||||
|
stop();
|
||||||
|
});
|
||||||
|
|
||||||
|
test( "autoFocus: true", function() {
|
||||||
|
var ac = $( "#autocomplete" ).autocomplete({
|
||||||
|
autoFocus: true,
|
||||||
|
delay: 0,
|
||||||
|
source: data,
|
||||||
|
open: function( event, ui ) {
|
||||||
|
equals( 1, ac.autocomplete( "widget" ).children( ".ui-menu-item:first .ui-state-focus" ).length, "first item is auto focused" );
|
||||||
|
start();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
ac.val( "ja" ).keydown();
|
||||||
|
stop();
|
||||||
|
});
|
||||||
|
|
||||||
test("delay", function() {
|
test("delay", function() {
|
||||||
var ac = $("#autocomplete").autocomplete({
|
var ac = $("#autocomplete").autocomplete({
|
||||||
|
Loading…
Reference in New Issue
Block a user