equal( parent.html().toLowerCase(), replacement );
});
+asyncTest( "Search if the user retypes the same value (#7434)", function() {
+ expect( 3 );
+ var element = $( "#autocomplete" ).autocomplete({
+ source: [ "java", "javascript" ],
+ delay: 0
+ }),
+ menu = element.autocomplete( "instance" ).menu.element;
+
+ element.val( "j" ).simulate( "keydown" );
+ setTimeout(function() {
+ ok( menu.is( ":visible" ), "menu displays initially" );
+ element.trigger( "blur" );
+ ok( !menu.is( ":visible" ), "menu hidden after blur" );
+ element.val( "j" ).simulate( "keydown" );
+ setTimeout(function() {
+ ok( menu.is( ":visible" ), "menu displays after typing the same value" );
+ start();
+ });
+ });
+});
+
}( jQuery ) );
_searchTimeout: function( event ) {
clearTimeout( this.searching );
this.searching = this._delay(function() {
- // only search if the value has changed
- if ( this.term !== this._value() ) {
+
+ // Search if the value has changed, or if the user retypes the same value (see #7434)
+ var equalValues = this.term === this._value(),
+ menuVisible = this.menu.element.is( ":visible" ),
+ modifierKey = event.altKey || event.ctrlKey || event.metaKey || event.shiftKey;
+
+ if ( !equalValues || ( equalValues && !menuVisible && !modifierKey ) ) {
this.selectedItem = null;
this.search( null, event );
}