diff options
author | Scott González <scott.gonzalez@gmail.com> | 2011-03-18 08:28:18 -0400 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2011-03-18 08:28:18 -0400 |
commit | 74d6069c161e8a4cbd21c284dc7c49cd7a7f86c9 (patch) | |
tree | 664fd43a709c6bfbfa35418c824c095d882697d8 | |
parent | 2b4a902e00b076661dc99528c88536e9460d415a (diff) | |
parent | 0ab3f5480f4b36f881f20ff3ca705173dc0b58f2 (diff) | |
download | jquery-ui-74d6069c161e8a4cbd21c284dc7c49cd7a7f86c9.tar.gz jquery-ui-74d6069c161e8a4cbd21c284dc7c49cd7a7f86c9.zip |
Merge branch '1-8-stable' of github.com:jquery/jquery-ui into 1-8-stable
-rw-r--r-- | tests/unit/autocomplete/autocomplete_options.js | 22 | ||||
-rw-r--r-- | ui/jquery.ui.autocomplete.js | 8 | ||||
-rw-r--r-- | version.txt | 2 |
3 files changed, 13 insertions, 19 deletions
diff --git a/tests/unit/autocomplete/autocomplete_options.js b/tests/unit/autocomplete/autocomplete_options.js index 09cfb6b5f..6ec4b69f2 100644 --- a/tests/unit/autocomplete/autocomplete_options.js +++ b/tests/unit/autocomplete/autocomplete_options.js @@ -97,32 +97,26 @@ test( "appendTo", function() { ac.autocomplete( "destroy" ); }); -test( "autoFocus: false", function() { +function autoFocusTest( afValue, focusedLength ) { var ac = $( "#autocomplete" ).autocomplete({ - autoFocus: false, + autoFocus: afValue, 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" ); + 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() { - 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(); + autoFocusTest( true, 1 ); }); test("delay", function() { diff --git a/ui/jquery.ui.autocomplete.js b/ui/jquery.ui.autocomplete.js index 204322320..dfe3fa3f3 100644 --- a/ui/jquery.ui.autocomplete.js +++ b/ui/jquery.ui.autocomplete.js @@ -360,16 +360,16 @@ $.widget( "ui.autocomplete", { this.menu.deactivate(); this.menu.refresh(); - if ( this.options.autoFocus ) { - this.menu.next( new $.Event("mouseover") ); - } - // size and position menu ul.show(); this._resizeMenu(); ul.position( $.extend({ of: this.element }, this.options.position )); + + if ( this.options.autoFocus ) { + this.menu.next( new $.Event("mouseover") ); + } }, _resizeMenu: function() { diff --git a/version.txt b/version.txt index b0473625e..b1f7b7d5c 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -1.8.11pre +1.8.12pre |