DEV: Speed up composer autocomplete tests (#17461)
It was pausing for 1s after each keyup event.
This commit is contained in:
parent
1dc2b3d1bb
commit
605aafec30
|
@ -10,6 +10,7 @@ import afterTransition from "discourse/lib/after-transition";
|
|||
import discourseDebounce from "discourse-common/lib/debounce";
|
||||
import { headerOffset } from "discourse/lib/offset-calculator";
|
||||
import positioningWorkaround from "discourse/lib/safari-hacks";
|
||||
import { isTesting } from "discourse-common/config/environment";
|
||||
|
||||
const START_DRAG_EVENTS = ["touchstart", "mousedown"];
|
||||
const DRAG_EVENTS = ["touchmove", "mousemove"];
|
||||
|
@ -62,12 +63,15 @@ export default Component.extend(KeyEnterEscape, {
|
|||
// One second from now, check to see if the last key was hit when
|
||||
// we recorded it. If it was, the user paused typing.
|
||||
cancel(this._lastKeyTimeout);
|
||||
this._lastKeyTimeout = later(() => {
|
||||
if (lastKeyUp !== this._lastKeyUp) {
|
||||
return;
|
||||
}
|
||||
this.appEvents.trigger("composer:find-similar");
|
||||
}, 1000);
|
||||
this._lastKeyTimeout = later(
|
||||
() => {
|
||||
if (lastKeyUp !== this._lastKeyUp) {
|
||||
return;
|
||||
}
|
||||
this.appEvents.trigger("composer:find-similar");
|
||||
},
|
||||
isTesting() ? 50 : 1000
|
||||
);
|
||||
},
|
||||
|
||||
@observes("composeState")
|
||||
|
|
Loading…
Reference in New Issue