FIX: We shouldn't debounce this in testing

Eventually we should add a helper to prevent all debouncing in test, but
for now this will really speed up Ember-CLI tests.
This commit is contained in:
Robin Ward 2020-11-20 11:54:02 -05:00
parent d6f2a63efe
commit 1ea6bbab34
1 changed files with 3 additions and 2 deletions

View File

@ -2,7 +2,7 @@ import getURL from "discourse-common/lib/get-url";
import I18n from "I18n";
import { isEmpty } from "@ember/utils";
import { and, or, alias, reads } from "@ember/object/computed";
import { cancel, debounce } from "@ember/runloop";
import { cancel, debounce, run } from "@ember/runloop";
import { inject as service } from "@ember/service";
import { inject } from "@ember/controller";
import Controller from "@ember/controller";
@ -1190,7 +1190,8 @@ export default Controller.extend({
if (Date.now() - this._lastDraftSaved > 15000) {
this._saveDraft();
} else {
this._saveDraftDebounce = debounce(this, this._saveDraft, 2000);
let method = isTesting() ? run : debounce;
this._saveDraftDebounce = method(this, this._saveDraft, 2000);
}
}
},