mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
Fix Wizard unit tests
This commit is contained in:
@@ -3,12 +3,12 @@ import { registerHelpers } from 'discourse-common/lib/helpers';
|
||||
export default {
|
||||
name: 'load-helpers',
|
||||
|
||||
initialize(container, registry) {
|
||||
initialize(application) {
|
||||
Object.keys(requirejs.entries).forEach(entry => {
|
||||
if ((/\/helpers\//).test(entry)) {
|
||||
require(entry, null, null, true);
|
||||
}
|
||||
});
|
||||
registerHelpers(registry);
|
||||
registerHelpers(application);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { componentTest } from 'wizard/test/helpers/component-test';
|
||||
|
||||
moduleForComponent('invite-list', { integration: true });
|
||||
|
||||
componentTest('can add users', {
|
||||
@@ -59,5 +58,4 @@ componentTest('can add users', {
|
||||
assert.ok(this.$('.users-list .invite-list-user').length === 0, 'removed the user');
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
import initializer from 'wizard/initializers/load-helpers';
|
||||
|
||||
|
||||
export function componentTest(name, opts) {
|
||||
opts = opts || {};
|
||||
|
||||
test(name, function(assert) {
|
||||
initializer.initialize(this.container, this.registry);
|
||||
initializer.initialize(this.registry);
|
||||
|
||||
if (opts.setup) {
|
||||
opts.setup.call(this);
|
||||
|
||||
@@ -8,7 +8,7 @@ export default function() {
|
||||
Ember.run(() => app = Wizard.create({ rootElement: '#ember-testing' }));
|
||||
|
||||
if (!started) {
|
||||
initializer.initialize(app.__container__, app.registry);
|
||||
initializer.initialize(app);
|
||||
app.start();
|
||||
started = true;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import WizardField from 'wizard/models/wizard-field';
|
||||
|
||||
module("model:wizard-field");
|
||||
moduleFor("model:wizard-field");
|
||||
|
||||
test('basic state', assert => {
|
||||
const w = WizardField.create({ type: 'text' });
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
//= require pretender
|
||||
//= require ./wizard-pretender
|
||||
|
||||
|
||||
// Trick JSHint into allow document.write
|
||||
var d = document;
|
||||
d.write('<div id="ember-testing-container"><div id="ember-testing"></div></div>');
|
||||
@@ -44,10 +45,9 @@ QUnit.testDone(function() {
|
||||
server.shutdown();
|
||||
});
|
||||
|
||||
require('wizard/test/helpers/start-app').default();
|
||||
|
||||
var buildResolver = require('discourse-common/resolver').buildResolver;
|
||||
window.setResolver(buildResolver('wizard').create());
|
||||
var _testApp = require('wizard/test/helpers/start-app').default();
|
||||
var _buildResolver = require('discourse-common/resolver').buildResolver;
|
||||
window.setResolver(_buildResolver('wizard').create({ namespace: _testApp }));
|
||||
|
||||
Object.keys(requirejs.entries).forEach(function(entry) {
|
||||
if ((/\-test/).test(entry)) {
|
||||
|
||||
Reference in New Issue
Block a user