Skip to content

Commit

Permalink
Merge pull request #23 from switchfly/isolated-container-registry
Browse files Browse the repository at this point in the history
Set `registry.normalizeFullName` to `resolver.normalize`.
  • Loading branch information
rwjblue committed Mar 11, 2015
2 parents 17bb72a + 071d6f3 commit cac7aa5
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 cac7aa5

Please sign in to comment.