DEV: Actually debounce functions in tests (#16213)
This commit is contained in:
parent
e82a2ce9ae
commit
0421a14319
|
@ -1,4 +1,4 @@
|
||||||
import { debounce, next } from "@ember/runloop";
|
import { debounce } from "@ember/runloop";
|
||||||
import { isTesting } from "discourse-common/config/environment";
|
import { isTesting } from "discourse-common/config/environment";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -9,9 +9,11 @@ import { isTesting } from "discourse-common/config/environment";
|
||||||
|
|
||||||
export default function () {
|
export default function () {
|
||||||
if (isTesting()) {
|
if (isTesting()) {
|
||||||
// Don't include the time argument (in ms)
|
// Replace the time argument with 10ms
|
||||||
let args = [].slice.call(arguments, 0, -1);
|
let args = [].slice.call(arguments, 0, -1);
|
||||||
return next.apply(void 0, args);
|
args.push(10);
|
||||||
|
|
||||||
|
return debounce.apply(undefined, args);
|
||||||
} else {
|
} else {
|
||||||
return debounce(...arguments);
|
return debounce(...arguments);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue