Upgrade ember qunit, create new interface for testing components
This commit is contained in:
parent
1397507d05
commit
7a58d64f37
|
@ -103,7 +103,7 @@ const PostMenuComponent = Ember.Component.extend(StringBuffer, {
|
||||||
|
|
||||||
const replyCount = post.get('reply_count');
|
const replyCount = post.get('reply_count');
|
||||||
buffer.push("<button class='show-replies highlight-action' data-action='replies'>");
|
buffer.push("<button class='show-replies highlight-action' data-action='replies'>");
|
||||||
buffer.push(I18n.t("post.has_replies", { count: replyCount }));
|
buffer.push(I18n.t("post.has_replies", { count: replyCount || 0 }));
|
||||||
|
|
||||||
const icon = (this.get('post.replies.length') > 0) ? 'chevron-up' : 'chevron-down';
|
const icon = (this.get('post.replies.length') > 0) ? 'chevron-up' : 'chevron-down';
|
||||||
return buffer.push(iconHTML(icon) + "</button>");
|
return buffer.push(iconHTML(icon) + "</button>");
|
||||||
|
|
|
@ -70,7 +70,7 @@ const Topic = RestModel.extend({
|
||||||
}.property('url'),
|
}.property('url'),
|
||||||
|
|
||||||
url: function() {
|
url: function() {
|
||||||
let slug = this.get('slug');
|
let slug = this.get('slug') || '';
|
||||||
if (slug.trim().length === 0) {
|
if (slug.trim().length === 0) {
|
||||||
slug = "topic";
|
slug = "topic";
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,19 +1,17 @@
|
||||||
|
import componentTest from 'helpers/component-test';
|
||||||
|
|
||||||
moduleForComponent('ace-editor', {integration: true});
|
moduleForComponent('ace-editor', {integration: true});
|
||||||
|
|
||||||
test('css editor', function(assert) {
|
componentTest('css editor', {
|
||||||
andThen(() => {
|
template: '{{ace-editor mode="css"}}',
|
||||||
this.render('{{ace-editor mode="css"}}');
|
test(assert) {
|
||||||
});
|
|
||||||
andThen(() => {
|
|
||||||
assert.ok(this.$('.ace_editor').length, 'it renders the ace editor');
|
assert.ok(this.$('.ace_editor').length, 'it renders the ace editor');
|
||||||
});
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
test('html editor', function(assert) {
|
componentTest('html editor', {
|
||||||
andThen(() => {
|
template: '{{ace-editor mode="html"}}',
|
||||||
this.render('{{ace-editor mode="html"}}');
|
test(assert) {
|
||||||
});
|
|
||||||
andThen(() => {
|
|
||||||
assert.ok(this.$('.ace_editor').length, 'it renders the ace editor');
|
assert.ok(this.$('.ace_editor').length, 'it renders the ace editor');
|
||||||
});
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
import componentTest from 'helpers/component-test';
|
||||||
|
|
||||||
|
moduleForComponent('post-menu', {integration: true});
|
||||||
|
|
||||||
|
componentTest('render buttons', {
|
||||||
|
template: "{{post-menu post=post}}",
|
||||||
|
setup(store) {
|
||||||
|
const topic = store.createRecord('topic', {id: 123});
|
||||||
|
this.set('post', store.createRecord('post', {id: 1, post_number: 1, topic}));
|
||||||
|
},
|
||||||
|
test(assert) {
|
||||||
|
assert.ok(this.$('.post-menu-area').length, 'it renders a post menu');
|
||||||
|
}
|
||||||
|
});
|
|
@ -1,31 +1,30 @@
|
||||||
|
import componentTest from 'helpers/component-test';
|
||||||
moduleForComponent('value-list', {integration: true});
|
moduleForComponent('value-list', {integration: true});
|
||||||
|
|
||||||
test('functionality', function(assert) {
|
componentTest('functionality', {
|
||||||
andThen(() => {
|
template: '{{value-list value=values}}',
|
||||||
this.render('{{value-list value=values}}');
|
test: function(assert) {
|
||||||
});
|
andThen(() => {
|
||||||
|
assert.ok(this.$('.values .value').length === 0, 'it has no values');
|
||||||
|
assert.ok(this.$('input').length, 'it renders the input');
|
||||||
|
assert.ok(this.$('.btn-primary[disabled]').length, 'it is disabled with no value');
|
||||||
|
});
|
||||||
|
|
||||||
andThen(() => {
|
fillIn('input', 'eviltrout');
|
||||||
assert.ok(this.$('.values .value').length === 0, 'it has no values');
|
andThen(() => {
|
||||||
assert.ok(this.$('input').length, 'it renders the input');
|
assert.ok(!this.$('.btn-primary[disabled]').length, "it isn't disabled anymore");
|
||||||
assert.ok(this.$('.btn-primary[disabled]').length, 'it is disabled with no value');
|
});
|
||||||
});
|
|
||||||
|
|
||||||
fillIn('input', 'eviltrout');
|
click('.btn-primary');
|
||||||
andThen(() => {
|
andThen(() => {
|
||||||
assert.ok(!this.$('.btn-primary[disabled]').length, "it isn't disabled anymore");
|
assert.ok(this.$('.values .value').length === 1, 'it adds the value');
|
||||||
});
|
assert.ok(this.$('input').val() === '', 'it clears the input');
|
||||||
|
assert.ok(this.$('.btn-primary[disabled]').length, "it is disabled again");
|
||||||
click('.btn-primary');
|
});
|
||||||
andThen(() => {
|
|
||||||
assert.ok(this.$('.values .value').length === 1, 'it adds the value');
|
|
||||||
assert.ok(this.$('input').val() === '', 'it clears the input');
|
|
||||||
assert.ok(this.$('.btn-primary[disabled]').length, "it is disabled again");
|
|
||||||
});
|
|
||||||
|
|
||||||
click('.value .btn-small');
|
|
||||||
andThen(() => {
|
|
||||||
assert.ok(this.$('.values .value').length === 0, 'it removes the value');
|
|
||||||
});
|
|
||||||
|
|
||||||
|
click('.value .btn-small');
|
||||||
|
andThen(() => {
|
||||||
|
assert.ok(this.$('.values .value').length === 0, 'it removes the value');
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
import createStore from 'helpers/create-store';
|
||||||
|
|
||||||
|
export default function(name, opts) {
|
||||||
|
opts = opts || {};
|
||||||
|
|
||||||
|
test(name, function(assert) {
|
||||||
|
if (opts.setup) {
|
||||||
|
const store = createStore();
|
||||||
|
opts.setup.call(this, store);
|
||||||
|
}
|
||||||
|
this.container.register('site-settings:main', Discourse.SiteSettings, { instantiate: false });
|
||||||
|
this.container.injection('component', 'siteSettings', 'site-settings:main');
|
||||||
|
|
||||||
|
andThen(() => {
|
||||||
|
this.render(opts.template);
|
||||||
|
});
|
||||||
|
|
||||||
|
andThen(() => {
|
||||||
|
opts.test.call(this, assert);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
|
@ -229,15 +229,10 @@ define('ember-qunit/test', ['exports', 'ember', 'ember-test-helpers', 'qunit'],
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
function resetViews() {
|
|
||||||
Ember['default'].View.views = {};
|
|
||||||
}
|
|
||||||
|
|
||||||
function test(testName, callback) {
|
function test(testName, callback) {
|
||||||
function wrapper(assert) {
|
function wrapper(assert) {
|
||||||
var context = ember_test_helpers.getContext();
|
var context = ember_test_helpers.getContext();
|
||||||
|
|
||||||
resetViews();
|
|
||||||
var result = callback.call(context, assert);
|
var result = callback.call(context, assert);
|
||||||
|
|
||||||
function failTestOnPromiseRejection(reason) {
|
function failTestOnPromiseRejection(reason) {
|
||||||
|
@ -261,13 +256,12 @@ define('ember-qunit/test', ['exports', 'ember', 'ember-test-helpers', 'qunit'],
|
||||||
exports['default'] = test;
|
exports['default'] = test;
|
||||||
|
|
||||||
});
|
});
|
||||||
define('ember-test-helpers', ['exports', 'ember', 'ember-test-helpers/isolated-container', 'ember-test-helpers/test-module', 'ember-test-helpers/test-module-for-component', 'ember-test-helpers/test-module-for-model', 'ember-test-helpers/test-context', 'ember-test-helpers/test-resolver'], function (exports, Ember, isolated_container, TestModule, TestModuleForComponent, TestModuleForModel, test_context, test_resolver) {
|
define('ember-test-helpers', ['exports', 'ember', 'ember-test-helpers/test-module', 'ember-test-helpers/test-module-for-component', 'ember-test-helpers/test-module-for-model', 'ember-test-helpers/test-context', 'ember-test-helpers/test-resolver'], function (exports, Ember, TestModule, TestModuleForComponent, TestModuleForModel, test_context, test_resolver) {
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
Ember['default'].testing = true;
|
Ember['default'].testing = true;
|
||||||
|
|
||||||
exports.isolatedContainer = isolated_container.isolatedContainer;
|
|
||||||
exports.TestModule = TestModule['default'];
|
exports.TestModule = TestModule['default'];
|
||||||
exports.TestModuleForComponent = TestModuleForComponent['default'];
|
exports.TestModuleForComponent = TestModuleForComponent['default'];
|
||||||
exports.TestModuleForModel = TestModuleForModel['default'];
|
exports.TestModuleForModel = TestModuleForModel['default'];
|
||||||
|
@ -276,13 +270,10 @@ define('ember-test-helpers', ['exports', 'ember', 'ember-test-helpers/isolated-c
|
||||||
exports.setResolver = test_resolver.setResolver;
|
exports.setResolver = test_resolver.setResolver;
|
||||||
|
|
||||||
});
|
});
|
||||||
define('ember-test-helpers/isolated-container', ['exports', 'ember-test-helpers/test-resolver', 'ember'], function (exports, test_resolver, Ember) {
|
define('ember-test-helpers/build-registry', ['exports'], function (exports) {
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
exports.isolatedRegistry = isolatedRegistry;
|
|
||||||
exports.isolatedContainer = isolatedContainer;
|
|
||||||
|
|
||||||
function exposeRegistryMethodsWithoutDeprecations(container) {
|
function exposeRegistryMethodsWithoutDeprecations(container) {
|
||||||
var methods = [
|
var methods = [
|
||||||
'register',
|
'register',
|
||||||
|
@ -309,86 +300,63 @@ define('ember-test-helpers/isolated-container', ['exports', 'ember-test-helpers/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function isolatedRegistry(fullNames) {
|
exports['default'] = function(resolver) {
|
||||||
var resolver = test_resolver.getResolver();
|
var registry, container;
|
||||||
var container;
|
var namespace = Ember.Object.create({
|
||||||
var registry;
|
Resolver: { create: function() { return resolver; } }
|
||||||
|
});
|
||||||
|
|
||||||
var normalize = function(fullName) {
|
function register(name, factory) {
|
||||||
return resolver.normalize(fullName);
|
var thingToRegisterWith = registry || container;
|
||||||
};
|
|
||||||
|
|
||||||
if (Ember['default'].Registry) {
|
if (!container.lookupFactory(name)) {
|
||||||
registry = new Ember['default'].Registry();
|
thingToRegisterWith.register(name, factory);
|
||||||
registry.normalizeFullName = normalize;
|
|
||||||
|
|
||||||
container = registry.container();
|
|
||||||
exposeRegistryMethodsWithoutDeprecations(container);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
container = new Ember['default'].Container();
|
|
||||||
|
|
||||||
//normalizeFullName only exists since Ember 1.9
|
|
||||||
if (Ember['default'].typeOf(container.normalizeFullName) === 'function') {
|
|
||||||
container.normalizeFullName = normalize;
|
|
||||||
} else {
|
|
||||||
container.normalize = normalize;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
container.optionsForType('component', { singleton: false });
|
if (Ember.Application.buildRegistry) {
|
||||||
container.optionsForType('view', { singleton: false });
|
registry = Ember.Application.buildRegistry(namespace);
|
||||||
container.optionsForType('template', { instantiate: false });
|
registry.register('component-lookup:main', Ember.ComponentLookup);
|
||||||
container.optionsForType('helper', { instantiate: false });
|
|
||||||
container.register('component-lookup:main', Ember['default'].ComponentLookup);
|
|
||||||
container.register('controller:basic', Ember['default'].Controller, { instantiate: false });
|
|
||||||
container.register('controller:object', Ember['default'].ObjectController, { instantiate: false });
|
|
||||||
container.register('controller:array', Ember['default'].ArrayController, { instantiate: false });
|
|
||||||
container.register('view:default', Ember['default']._MetamorphView);
|
|
||||||
container.register('view:toplevel', Ember['default'].View.extend());
|
|
||||||
container.register('view:select', Ember['default'].Select);
|
|
||||||
container.register('route:basic', Ember['default'].Route, { instantiate: false });
|
|
||||||
|
|
||||||
// added in Glimmer
|
registry = registry;
|
||||||
container.register('component:-link-to', Ember['default'].LinkView);
|
container = registry.container();
|
||||||
container.register('component:-text-field', Ember['default'].TextField);
|
exposeRegistryMethodsWithoutDeprecations(container);
|
||||||
container.register('component:-text-area', Ember['default'].TextArea);
|
} else {
|
||||||
container.register('component:-checkbox', Ember['default'].Checkbox);
|
container = Ember.Application.buildContainer(namespace);
|
||||||
|
container.register('component-lookup:main', Ember.ComponentLookup);
|
||||||
if (Ember['default']._LegacyEachView) {
|
|
||||||
container.register('view:-legacy-each', Ember['default']._LegacyEachView);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Ember 1.10.0 did not properly add `view:toplevel` or `view:default`
|
||||||
|
// to the registry in Ember.Application.buildRegistry :(
|
||||||
|
register('view:toplevel', Ember.View.extend());
|
||||||
|
register('view:default', Ember._MetamorphView);
|
||||||
|
|
||||||
var globalContext = typeof global === 'object' && global || self;
|
var globalContext = typeof global === 'object' && global || self;
|
||||||
if (globalContext.DS) {
|
if (globalContext.DS) {
|
||||||
var DS = globalContext.DS;
|
var DS = globalContext.DS;
|
||||||
if (DS._setupContainer) {
|
if (DS._setupContainer) {
|
||||||
DS._setupContainer(container);
|
DS._setupContainer(registry || container);
|
||||||
} else {
|
} else {
|
||||||
container.register('transform:boolean', DS.BooleanTransform);
|
register('transform:boolean', DS.BooleanTransform);
|
||||||
container.register('transform:date', DS.DateTransform);
|
register('transform:date', DS.DateTransform);
|
||||||
container.register('transform:number', DS.NumberTransform);
|
register('transform:number', DS.NumberTransform);
|
||||||
container.register('transform:string', DS.StringTransform);
|
register('transform:string', DS.StringTransform);
|
||||||
container.register('serializer:-default', DS.JSONSerializer);
|
register('serializer:-default', DS.JSONSerializer);
|
||||||
container.register('serializer:-rest', DS.RESTSerializer);
|
register('serializer:-rest', DS.RESTSerializer);
|
||||||
container.register('adapter:-rest', DS.RESTAdapter);
|
register('adapter:-rest', DS.RESTAdapter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var i = fullNames.length; i > 0; i--) {
|
|
||||||
var fullName = fullNames[i - 1];
|
|
||||||
var normalizedFullName = resolver.normalize(fullName);
|
|
||||||
container.register(fullName, resolver.resolve(normalizedFullName));
|
|
||||||
}
|
|
||||||
return {
|
return {
|
||||||
container: container,
|
registry: registry,
|
||||||
registry: registry
|
container: container
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function isolatedContainer(fullNames) {
|
});
|
||||||
return isolatedRegistry(fullNames).container;
|
define('ember-test-helpers/isolated-container', function () {
|
||||||
}
|
|
||||||
|
'use strict';
|
||||||
|
|
||||||
});
|
});
|
||||||
define('ember-test-helpers/test-context', ['exports'], function (exports) {
|
define('ember-test-helpers/test-context', ['exports'], function (exports) {
|
||||||
|
@ -417,8 +385,10 @@ define('ember-test-helpers/test-module-for-component', ['exports', 'ember-test-h
|
||||||
init: function(componentName, description, callbacks) {
|
init: function(componentName, description, callbacks) {
|
||||||
// Allow `description` to be omitted
|
// Allow `description` to be omitted
|
||||||
if (!callbacks && typeof description === 'object') {
|
if (!callbacks && typeof description === 'object') {
|
||||||
callbacks = description || {};
|
callbacks = description;
|
||||||
description = null;
|
description = null;
|
||||||
|
} else if (!callbacks) {
|
||||||
|
callbacks = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
this.componentName = componentName;
|
this.componentName = componentName;
|
||||||
|
@ -500,7 +470,7 @@ define('ember-test-helpers/test-module-for-component', ['exports', 'ember-test-h
|
||||||
},
|
},
|
||||||
|
|
||||||
setupComponentIntegrationTest: function() {
|
setupComponentIntegrationTest: function() {
|
||||||
var self = this;
|
var module = this;
|
||||||
var context = this.context;
|
var context = this.context;
|
||||||
context.dispatcher = Ember['default'].EventDispatcher.create();
|
context.dispatcher = Ember['default'].EventDispatcher.create();
|
||||||
context.dispatcher.setup({}, '#ember-testing');
|
context.dispatcher.setup({}, '#ember-testing');
|
||||||
|
@ -516,19 +486,20 @@ define('ember-test-helpers/test-module-for-component', ['exports', 'ember-test-h
|
||||||
if (typeof template === 'string') {
|
if (typeof template === 'string') {
|
||||||
template = Ember['default'].Handlebars.compile(template);
|
template = Ember['default'].Handlebars.compile(template);
|
||||||
}
|
}
|
||||||
self.component = Ember['default'].View.create({
|
module.component = Ember['default'].Component.create({
|
||||||
context: context,
|
layout: template,
|
||||||
controller: self,
|
container: module.container
|
||||||
template: template,
|
|
||||||
container: self.container
|
|
||||||
});
|
});
|
||||||
|
module.component.set('context' ,context);
|
||||||
|
module.component.set('controller', module);
|
||||||
|
|
||||||
Ember['default'].run(function() {
|
Ember['default'].run(function() {
|
||||||
self.component.appendTo('#ember-testing');
|
module.component.appendTo('#ember-testing');
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
context.$ = function() {
|
context.$ = function() {
|
||||||
return self.component.$.apply(self.component, arguments);
|
return module.component.$.apply(module.component, arguments);
|
||||||
};
|
};
|
||||||
|
|
||||||
context.set = function(key, value) {
|
context.set = function(key, value) {
|
||||||
|
@ -542,7 +513,7 @@ define('ember-test-helpers/test-module-for-component', ['exports', 'ember-test-h
|
||||||
};
|
};
|
||||||
|
|
||||||
context.on = function(actionName, handler) {
|
context.on = function(actionName, handler) {
|
||||||
self.actionHooks[actionName] = handler;
|
module.actionHooks[actionName] = handler;
|
||||||
};
|
};
|
||||||
|
|
||||||
},
|
},
|
||||||
|
@ -602,8 +573,8 @@ define('ember-test-helpers/test-module-for-model', ['exports', 'ember-test-helpe
|
||||||
|
|
||||||
callbacks.store = function(){
|
callbacks.store = function(){
|
||||||
var container = this.container;
|
var container = this.container;
|
||||||
|
var store = container.lookup('service:store') || container.lookup('store:main');
|
||||||
return container.lookup('store:main');
|
return store;
|
||||||
};
|
};
|
||||||
|
|
||||||
if (callbacks.subject === defaultSubject) {
|
if (callbacks.subject === defaultSubject) {
|
||||||
|
@ -611,7 +582,8 @@ define('ember-test-helpers/test-module-for-model', ['exports', 'ember-test-helpe
|
||||||
var container = this.container;
|
var container = this.container;
|
||||||
|
|
||||||
return Ember['default'].run(function() {
|
return Ember['default'].run(function() {
|
||||||
return container.lookup('store:main').createRecord(modelName, options);
|
var store = container.lookup('service:store') || container.lookup('store:main');
|
||||||
|
return store.createRecord(modelName, options);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -619,7 +591,7 @@ define('ember-test-helpers/test-module-for-model', ['exports', 'ember-test-helpe
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
define('ember-test-helpers/test-module', ['exports', 'ember', 'ember-test-helpers/isolated-container', 'ember-test-helpers/test-context', 'klassy', 'ember-test-helpers/test-resolver'], function (exports, Ember, isolated_container, test_context, klassy, test_resolver) {
|
define('ember-test-helpers/test-module', ['exports', 'ember', 'ember-test-helpers/test-context', 'klassy', 'ember-test-helpers/test-resolver', 'ember-test-helpers/build-registry'], function (exports, Ember, test_context, klassy, test_resolver, buildRegistry) {
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
@ -638,7 +610,7 @@ define('ember-test-helpers/test-module', ['exports', 'ember', 'ember-test-helper
|
||||||
this.callbacks = callbacks || {};
|
this.callbacks = callbacks || {};
|
||||||
|
|
||||||
if (this.callbacks.integration) {
|
if (this.callbacks.integration) {
|
||||||
this.isIntegration = callbacks.integration;
|
this.isIntegration = callbacks.integration;
|
||||||
delete callbacks.integration;
|
delete callbacks.integration;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -655,7 +627,7 @@ define('ember-test-helpers/test-module', ['exports', 'ember', 'ember-test-helper
|
||||||
initNeeds: function() {
|
initNeeds: function() {
|
||||||
this.needs = [this.subjectName];
|
this.needs = [this.subjectName];
|
||||||
if (this.callbacks.needs) {
|
if (this.callbacks.needs) {
|
||||||
this.needs = this.needs.concat(this.callbacks.needs)
|
this.needs = this.needs.concat(this.callbacks.needs);
|
||||||
delete this.callbacks.needs;
|
delete this.callbacks.needs;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -726,7 +698,10 @@ define('ember-test-helpers/test-module', ['exports', 'ember', 'ember-test-helper
|
||||||
function nextStep() {
|
function nextStep() {
|
||||||
var step = steps.shift();
|
var step = steps.shift();
|
||||||
if (step) {
|
if (step) {
|
||||||
return Ember['default'].RSVP.resolve(step.call(context)).then(nextStep);
|
// guard against exceptions, for example missing components referenced from needs.
|
||||||
|
return new Ember['default'].RSVP.Promise(function(ok) {
|
||||||
|
ok(step.call(context));
|
||||||
|
}).then(nextStep);
|
||||||
} else {
|
} else {
|
||||||
return Ember['default'].RSVP.resolve();
|
return Ember['default'].RSVP.resolve();
|
||||||
}
|
}
|
||||||
|
@ -811,7 +786,7 @@ define('ember-test-helpers/test-module', ['exports', 'ember', 'ember-test-helper
|
||||||
this.cache = this.cache || {};
|
this.cache = this.cache || {};
|
||||||
this.cachedCalls = this.cachedCalls || {};
|
this.cachedCalls = this.cachedCalls || {};
|
||||||
|
|
||||||
var keys = Ember['default'].keys(callbacks);
|
var keys = (Object.keys || Ember['default'].keys)(callbacks);
|
||||||
|
|
||||||
for (var i = 0, l = keys.length; i < l; i++) {
|
for (var i = 0, l = keys.length; i < l; i++) {
|
||||||
(function(key) {
|
(function(key) {
|
||||||
|
@ -831,29 +806,36 @@ define('ember-test-helpers/test-module', ['exports', 'ember', 'ember-test-helper
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_setupContainer: function() {
|
||||||
|
var resolver = test_resolver.getResolver();
|
||||||
|
var items = buildRegistry['default'](resolver);
|
||||||
|
|
||||||
|
this.container = items.container;
|
||||||
|
this.registry = items.registry;
|
||||||
|
|
||||||
|
var thingToRegisterWith = this.registry || this.container;
|
||||||
|
var router = resolver.resolve('router:main');
|
||||||
|
router = router || Ember['default'].Router.extend();
|
||||||
|
thingToRegisterWith.register('router:main', router);
|
||||||
|
},
|
||||||
|
|
||||||
_setupIsolatedContainer: function() {
|
_setupIsolatedContainer: function() {
|
||||||
var isolated = isolated_container.isolatedRegistry(this.needs);
|
var resolver = test_resolver.getResolver();
|
||||||
this.container = isolated.container;
|
this._setupContainer();
|
||||||
this.registry = isolated.registry;
|
|
||||||
|
var thingToRegisterWith = this.registry || this.container;
|
||||||
|
|
||||||
|
for (var i = this.needs.length; i > 0; i--) {
|
||||||
|
var fullName = this.needs[i - 1];
|
||||||
|
var normalizedFullName = resolver.normalize(fullName);
|
||||||
|
thingToRegisterWith.register(fullName, resolver.resolve(normalizedFullName));
|
||||||
|
}
|
||||||
|
|
||||||
|
thingToRegisterWith.resolver = function() { };
|
||||||
},
|
},
|
||||||
|
|
||||||
_setupIntegratedContainer: function() {
|
_setupIntegratedContainer: function() {
|
||||||
var resolver = test_resolver.getResolver();
|
this._setupContainer();
|
||||||
var namespace = Ember['default'].Object.create({
|
|
||||||
Resolver: { create: function() { return resolver; } }
|
|
||||||
});
|
|
||||||
|
|
||||||
if (Ember['default'].Application.buildRegistry) {
|
|
||||||
var registry;
|
|
||||||
registry = Ember['default'].Application.buildRegistry(namespace);
|
|
||||||
registry.register('component-lookup:main', Ember['default'].ComponentLookup);
|
|
||||||
this.registry = registry;
|
|
||||||
this.container = registry.container();
|
|
||||||
} else {
|
|
||||||
this.container = Ember['default'].Application.buildContainer(namespace);
|
|
||||||
this.container.register('component-lookup:main', Ember['default'].ComponentLookup);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -1061,3 +1043,4 @@ window.test = emberQunit.test;
|
||||||
window.setResolver = emberQunit.setResolver;
|
window.setResolver = emberQunit.setResolver;
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
//# sourceMappingURL=ember-qunit.map
|
Loading…
Reference in New Issue