DEV: Actually debounce functions in tests (#16213)

This commit is contained in:
Jarek Radosz 2022-06-21 23:34:04 +02:00 committed by GitHub
parent e82a2ce9ae
commit 0421a14319
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 3 deletions

View File

@ -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);
} }