Skip to content

Commit

Permalink
Start working on making the alpha pass.
Browse files Browse the repository at this point in the history
* Add alpha to ember-try setup (allowed to fail for now).
* Ensure component integration tests instantiate templates through the container.
  • Loading branch information
Robert Jackson committed Aug 1, 2016
1 parent 20ca36e commit ebb64fa
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 6 deletions.
20 changes: 20 additions & 0 deletions config/ember-try.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,26 @@ module.exports = {
}
}
},
{
name: 'ember-alpha',
allowedToFail: true,
bower: {
dependencies: {
"ember": "alpha"
},
devDependencies: {
"ember-cli-shims": "ember-cli/ember-cli-shims#0.1.0"
},
resolutions: {
"ember": "alpha"
}
},
npm: {
devDependencies: {
"ember-data": "^2.5.0"
}
}
},
{
name: 'ember-data-2.3',
bower: {
Expand Down
28 changes: 22 additions & 6 deletions lib/ember-test-helpers/test-module-for-component.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,13 +142,12 @@ export default TestModule.extend({
context.dispatcher = this.container.lookup('event_dispatcher:main') || Ember.EventDispatcher.create();
context.dispatcher.setup({}, '#ember-testing');

var hasRendered = false;
var OutletView = module.container.lookupFactory('view:-outlet');
var toplevelView = module.component = OutletView.create();
toplevelView.setOutletState({ render: { }, outlets: { }});

var element = document.getElementById('ember-testing');
Ember.run(module.component, 'appendTo', '#ember-testing');

var templateId = 0;
context.render = function(template) {
if (!template) {
throw new Error("in a component integration test you must pass a template to `render()`");
Expand All @@ -160,17 +159,29 @@ export default TestModule.extend({
template = Ember.Handlebars.compile(template);
}

Ember.run(function() {
var templateFullName = 'template:-undertest-' + (++templateId);
this.registry.register(templateFullName, template);
Ember.run(() => {
toplevelView.setOutletState({
render: {
owner: this.owner,
into: undefined,
outlet: 'main',
name: 'application',
controller: module.context,
template
ViewClass: undefined,
template: this.container.lookup(templateFullName)
},

outlets: { }
});
});

if (!hasRendered) {
Ember.run(module.component, 'appendTo', '#ember-testing');
hasRendered = true;
}

// ensure the element is based on the wrapping toplevel view
// Ember still wraps the main application template with a
// normal tagged view
Expand Down Expand Up @@ -228,8 +239,13 @@ export default TestModule.extend({
Ember.run(function() {
toplevelView.setOutletState({
render: {
owner: module.container,
into: undefined,
outlet: 'main',
name: 'application',
controller: module.context,
randomKey: 'empty'
ViewClass: undefined,
template: undefined
},
outlets: {}
});
Expand Down

0 comments on commit ebb64fa

Please sign in to comment.