}, 50 );
});
+asyncTest( "blur during remote search", function() {
+ expect( 1 );
+ var ac = $( "#autocomplete" ).autocomplete({
+ delay: 0,
+ source: function( request, response ) {
+ ok( true, "trigger request" );
+ ac.simulate( "blur" );
+ setTimeout(function() {
+ response([ "result" ]);
+ start();
+ }, 100 );
+ },
+ open: function() {
+ ok( false, "opened after a blur" );
+ }
+ });
+ ac.val( "ro" ).keydown();
+});
+
/* TODO previous fix broke more than it fixed, disabling this for now - messed up regular menu select event
test("blur without selection", function() {
expect(1);
}
clearTimeout( self.searching );
+ self.cancelSearch = true;
// clicks on the menu (or a button to trigger a search) will cause a blur event
self.closing = setTimeout(function() {
self.close( event );
_search: function( value ) {
this.pending++;
this.element.addClass( "ui-autocomplete-loading" );
+ this.cancelSearch = false;
this.source( { term: value }, this.response );
},
content = this._normalize( content );
}
this._trigger( "response", null, { content: content } );
- if ( !this.options.disabled && content && content.length ) {
+ if ( !this.options.disabled && content && content.length && !this.cancelSearch ) {
this._suggest( content );
this._trigger( "open" );
} else {