Skip to content

Commit

Permalink
consistently use the new view registry
Browse files Browse the repository at this point in the history
  • Loading branch information
ef4 committed Jul 28, 2015
1 parent 3315c6d commit 913b815
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/ember-test-helpers/test-module-for-component.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export default TestModule.extend({
thingToRegisterWith.injection(this.subjectName, 'layout', layoutName);
}

context.dispatcher = Ember.EventDispatcher.create();
context.dispatcher = this.container.lookup('event_dispatcher:main') || Ember.EventDispatcher.create();
context.dispatcher.setup({}, '#ember-testing');

this.callbacks.render = function() {
Expand Down Expand Up @@ -96,7 +96,7 @@ export default TestModule.extend({

this.actionHooks = {};

context.dispatcher = Ember.EventDispatcher.create();
context.dispatcher = this.container.lookup('event_dispatcher:main') || Ember.EventDispatcher.create();
context.dispatcher.setup({}, '#ember-testing');
context.actions = module.actionHooks;

Expand Down
9 changes: 8 additions & 1 deletion lib/ember-test-helpers/test-module.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ export default Klass.extend({
this.context = undefined;
unsetContext();

if (context.dispatcher) {
if (context.dispatcher && !context.dispatcher.isDestroyed) {
Ember.run(function() {
context.dispatcher.destroy();
});
Expand Down Expand Up @@ -230,6 +230,13 @@ export default Klass.extend({
this.container = items.container;
this.registry = items.registry;


var viewRegistry = this.container.lookup('-view-registry:main');
if (viewRegistry) {
var View = Ember.__loader.require('ember-views/views/view').default;
View.views = viewRegistry;
}

var thingToRegisterWith = this.registry || this.container;
var router = resolver.resolve('router:main');
router = router || Ember.Router.extend();
Expand Down

0 comments on commit 913b815

Please sign in to comment.