mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
ES6: Notification controllers, added helper to create via ES6/container
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* global asyncTest */
|
||||
/* global asyncTest, requirejs, require */
|
||||
/* exported integration, testController, controllerFor, asyncTestDiscourse, fixture */
|
||||
function integration(name, lifecycle) {
|
||||
module("Integration: " + name, {
|
||||
@@ -25,6 +25,15 @@ function integration(name, lifecycle) {
|
||||
}
|
||||
|
||||
function testController(klass, model) {
|
||||
// HAX until we get ES6 everywhere:
|
||||
if (typeof klass === "string") {
|
||||
var moduleName = 'discourse/controllers/' + klass,
|
||||
module = requirejs.entries[moduleName];
|
||||
if (module) {
|
||||
klass = require(moduleName, null, null, true).default;
|
||||
}
|
||||
}
|
||||
|
||||
return klass.create({model: model, container: Discourse.__container__});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user