FIX: Use modules for `Ember.run.debounce` hack in testing

This commit is contained in:
Robin Ward 2019-10-29 16:25:37 -04:00
parent e5525d03b8
commit 249dff85c7
2 changed files with 2 additions and 9 deletions

View File

@ -17,7 +17,7 @@ var define, requirejs;
"@ember/runloop": {
bind: Ember.run.bind,
cancel: Ember.run.cancel,
debounce: Ember.run.debounce,
debounce: Ember.testing ? Ember.run : Ember.run.debounce,
later: Ember.run.later,
next: Ember.run.next,
once: Ember.run.once,

View File

@ -73,8 +73,7 @@ if (window.Logster) {
window.Logster = { enabled: false };
}
var origDebounce = Ember.run.debounce,
pretender = require("helpers/create-pretender", null, null, false),
var pretender = require("helpers/create-pretender", null, null, false),
fixtures = require("fixtures/site-fixtures", null, null, false).default,
flushMap = require("discourse/models/store", null, null, false).flushMap,
ScrollingDOMMethods = require("discourse/mixins/scrolling", null, null, false)
@ -137,15 +136,9 @@ QUnit.testStart(function(ctx) {
// Unless we ever need to test this, let's leave it off.
$.fn.autocomplete = function() {};
// Don't debounce in test unless we're testing debouncing
if (ctx.module.indexOf("debounce") === -1) {
Ember.run.debounce = Ember.run;
}
});
QUnit.testDone(function() {
Ember.run.debounce = origDebounce;
window.sandbox.restore();
// Destroy any modals