FIX: do not cancel search early in tests (#10445)
This is done to avoid cases where search would be cancelled before debounce.
This commit is contained in:
parent
fcfaa8b063
commit
3e49c5b4d8
|
@ -1,10 +1,10 @@
|
|||
import { isTesting } from "discourse-common/config/environment";
|
||||
import discourseDebounce from "discourse/lib/debounce";
|
||||
import { CANCELLED_STATUS } from "discourse/lib/autocomplete";
|
||||
import { userPath } from "discourse/lib/url";
|
||||
import { emailValid } from "discourse/lib/utilities";
|
||||
import { Promise } from "rsvp";
|
||||
import { later, cancel } from "@ember/runloop";
|
||||
import { isTesting } from "discourse-common/config/environment";
|
||||
|
||||
var cache = {},
|
||||
cacheKey,
|
||||
|
@ -182,12 +182,10 @@ export default function userSearch(options) {
|
|||
|
||||
cacheKey = newCacheKey;
|
||||
|
||||
const clearPromise = later(
|
||||
() => {
|
||||
resolve(CANCELLED_STATUS);
|
||||
},
|
||||
isTesting() ? 250 : 5000
|
||||
);
|
||||
let clearPromise;
|
||||
if (!isTesting()) {
|
||||
clearPromise = later(() => resolve(CANCELLED_STATUS), 5000);
|
||||
}
|
||||
|
||||
if (skipSearch(term, options.allowEmails)) {
|
||||
resolve([]);
|
||||
|
|
Loading…
Reference in New Issue