diff --git a/lib/ember-test-helpers/test-module-for-component.js b/lib/ember-test-helpers/test-module-for-component.js index 1136948aa..bc0bc8370 100644 --- a/lib/ember-test-helpers/test-module-for-component.js +++ b/lib/ember-test-helpers/test-module-for-component.js @@ -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() { @@ -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; diff --git a/lib/ember-test-helpers/test-module.js b/lib/ember-test-helpers/test-module.js index 442c84852..5a8af2de1 100644 --- a/lib/ember-test-helpers/test-module.js +++ b/lib/ember-test-helpers/test-module.js @@ -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(); }); @@ -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();