mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Merge branch '1-8-stable' of github.com:jquery/jquery-ui into 1-8-stable
This commit is contained in:
commit
74d6069c16
@ -97,32 +97,26 @@ test( "appendTo", function() {
|
|||||||
ac.autocomplete( "destroy" );
|
ac.autocomplete( "destroy" );
|
||||||
});
|
});
|
||||||
|
|
||||||
test( "autoFocus: false", function() {
|
function autoFocusTest( afValue, focusedLength ) {
|
||||||
var ac = $( "#autocomplete" ).autocomplete({
|
var ac = $( "#autocomplete" ).autocomplete({
|
||||||
autoFocus: false,
|
autoFocus: afValue,
|
||||||
delay: 0,
|
delay: 0,
|
||||||
source: data,
|
source: data,
|
||||||
open: function( event, ui ) {
|
open: function( event, ui ) {
|
||||||
equals( 0, ac.autocomplete( "widget" ).children( ".ui-menu-item:first .ui-state-focus" ).length, "first item is not auto focused" );
|
equal( ac.autocomplete( "widget" ).children( ".ui-menu-item:first .ui-state-hover" ).length, focusedLength, "first item is " + afValue ? "" : "not" + " auto focused" );
|
||||||
start();
|
start();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
ac.val( "ja" ).keydown();
|
ac.val( "ja" ).keydown();
|
||||||
stop();
|
stop();
|
||||||
|
}
|
||||||
|
|
||||||
|
test( "autoFocus: false", function() {
|
||||||
|
autoFocusTest( false, 0 );
|
||||||
});
|
});
|
||||||
|
|
||||||
test( "autoFocus: true", function() {
|
test( "autoFocus: true", function() {
|
||||||
var ac = $( "#autocomplete" ).autocomplete({
|
autoFocusTest( true, 1 );
|
||||||
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() {
|
||||||
|
8
ui/jquery.ui.autocomplete.js
vendored
8
ui/jquery.ui.autocomplete.js
vendored
@ -360,16 +360,16 @@ $.widget( "ui.autocomplete", {
|
|||||||
this.menu.deactivate();
|
this.menu.deactivate();
|
||||||
this.menu.refresh();
|
this.menu.refresh();
|
||||||
|
|
||||||
if ( this.options.autoFocus ) {
|
|
||||||
this.menu.next( new $.Event("mouseover") );
|
|
||||||
}
|
|
||||||
|
|
||||||
// size and position menu
|
// size and position menu
|
||||||
ul.show();
|
ul.show();
|
||||||
this._resizeMenu();
|
this._resizeMenu();
|
||||||
ul.position( $.extend({
|
ul.position( $.extend({
|
||||||
of: this.element
|
of: this.element
|
||||||
}, this.options.position ));
|
}, this.options.position ));
|
||||||
|
|
||||||
|
if ( this.options.autoFocus ) {
|
||||||
|
this.menu.next( new $.Event("mouseover") );
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_resizeMenu: function() {
|
_resizeMenu: function() {
|
||||||
|
@ -1 +1 @@
|
|||||||
1.8.11pre
|
1.8.12pre
|
||||||
|
Loading…
Reference in New Issue
Block a user