From 6a55a8061936a7c243e2d7f892456c06d29465c3 Mon Sep 17 00:00:00 2001 From: Dan Gebhardt Date: Wed, 11 Mar 2015 15:14:58 -0400 Subject: [PATCH] Set `registry.normalizeFullName` to `resolve.normalize`. When the `Registry` is present, its `normalizeFullName` method should be set to the resolver's `normalize` method. Overriding the normalize methods on the container is ineffective because they need to proxy to the associated registry's methods. --- lib/ember-test-helpers/isolated-container.js | 22 ++++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/lib/ember-test-helpers/isolated-container.js b/lib/ember-test-helpers/isolated-container.js index 49852d198..6efdb13a0 100644 --- a/lib/ember-test-helpers/isolated-container.js +++ b/lib/ember-test-helpers/isolated-container.js @@ -31,24 +31,28 @@ export default function isolatedContainer(fullNames) { var resolver = getResolver(); var container; + var normalize = function(fullName) { + return resolver.normalize(fullName); + }; + if (Ember.Registry) { var registry = new Ember.Registry(); + registry.normalizeFullName = normalize; + container = registry.container(); exposeRegistryMethodsWithoutDeprecations(container); } else { container = new Ember.Container(); - } - var normalize = function(fullName) { - return resolver.normalize(fullName); - }; - //normalizeFullName only exists since Ember 1.9 - if (Ember.typeOf(container.normalizeFullName) === 'function') { - container.normalizeFullName = normalize; - } else { - container.normalize = normalize; + //normalizeFullName only exists since Ember 1.9 + if (Ember.typeOf(container.normalizeFullName) === 'function') { + container.normalizeFullName = normalize; + } else { + container.normalize = normalize; + } } + container.optionsForType('component', { singleton: false }); container.optionsForType('view', { singleton: false }); container.optionsForType('template', { instantiate: false });