Skip to content

A platform for community discussion. Free, open, simple.

DEV: Actually debounce functions in tests (#16213)

Jarek Radosz0421a14319c5
diff --git a/app/assets/javascripts/discourse-common/addon/lib/debounce.js b/app/assets/javascripts/discourse-common/addon/lib/debounce.js
index cfd54b32d6f..2bcd387724a 100644
--- a/app/assets/javascripts/discourse-common/addon/lib/debounce.js
+++ b/app/assets/javascripts/discourse-common/addon/lib/debounce.js
@@ -1,4 +1,4 @@
-import { debounce, next } from "@ember/runloop";
+import { debounce } from "@ember/runloop";
import { isTesting } from "discourse-common/config/environment";
/**
@@ -9,9 +9,11 @@ import { isTesting } from "discourse-common/config/environment";
export default function () {
if (isTesting()) {
- // Don't include the time argument (in ms)
+ // Replace the time argument with 10ms
let args = [].slice.call(arguments, 0, -1);
- return next.apply(void 0, args);
+ args.push(10);
+
+ return debounce.apply(undefined, args);
} else {
return debounce(...arguments);
}