Skip to content

Commit

Permalink
Set registry.normalizeFullName to resolver.normalize.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
dgeb committed Mar 11, 2015
1 parent 17bb72a commit 071d6f3
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions lib/ember-test-helpers/isolated-container.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
Expand Down

0 comments on commit 071d6f3

Please sign in to comment.