discourse/app/assets/javascripts/test-shims.js
Robin Ward 61f5d501cb
DEV: Migrate to Ember CLI (#11932)
This encompasses a lot of work done over the last year, much of which
has already been merged into master. This is the final set of changes
required to get Ember CLI running locally for development.

From here on it will be bug fixes / enhancements.

Co-authored-by: Jarek Radosz <jradosz@gmail.com>
Co-authored-by: romanrizzi <rizziromanalejandro@gmail.com>

Co-authored-by: Jarek Radosz <jradosz@gmail.com>
Co-authored-by: romanrizzi <rizziromanalejandro@gmail.com>
2021-02-03 14:22:20 -05:00

63 lines
1.2 KiB
JavaScript

// discourse-skip-module
define("sinon", () => {
return { default: window.sinon };
});
define("qunit", () => {
return {
default: window.QUnit,
test: window.QUnit.test,
skip: window.QUnit.skip,
module: window.QUnit.module,
};
});
define("ember-qunit", () => {
return {
moduleFor: window.moduleFor,
moduleForComponent: window.moduleForComponent,
};
});
define("htmlbars-inline-precompile", () => {
return {
default: function (str) {
return Ember.HTMLBars.compile(str[0]);
},
};
});
let _app;
define("@ember/test-helpers", () => {
let helpers = {
setApplication(app) {
_app = app;
},
getApplication() {
return _app;
},
async settled() {
// No-op in pre ember-cli environment
},
TestModuleForComponent: window.TestModuleForComponent,
};
[
"click",
"visit",
"currentURL",
"currentRouteName",
"fillIn",
"setResolver",
"triggerEvent",
].forEach((attr) => {
helpers[attr] = function () {
return window[attr](...arguments);
};
});
helpers.triggerKeyEvent = function () {
return window.keyEvent(...arguments);
};
return helpers;
});
define("pretender", () => {
return { default: window.Pretender };
});