You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The IsolatedContainer doesn't normalize type keys from oneThing to one-thing as the regular container would do.
This is an issue because ember-data accepts relationship using camelcased model names, so configuring a test with needs: ['model:one-thing'] and using oneThing: DS.belongsTo('oneThing') in a model definition will cause the resolver to crash when looking for oneThing (through store.modelFor).
Based on what ember / ember-cli does, this patch fixes the issue for me, but I do not understand the resolver well enough to be confident in that change.
diff --git a/lib/isolated-container.js b/lib/isolated-container.js
index 0293b9c..cae4ae9 100644
--- a/lib/isolated-container.js+++ b/lib/isolated-container.js@@ -4,6 +4,10 @@ import Ember from 'ember';
export default function isolatedContainer(fullNames) {
var resolver = testResolver.get();
var container = new Ember.Container();
+ container.resolver = function(name) {+ return resolver.resolve(name);+ }+ container.normalize = resolver.normalize;
container.optionsForType('component', { singleton: false });
container.optionsForType('view', { singleton: false });
container.optionsForType('template', { instantiate: false });
The text was updated successfully, but these errors were encountered:
I think the same thing just bit me as well. When I specify
needs: ['serializer:embedd-switch-port-mapping']
any the code I test calls store.serializerFor('embedd-switch-port-mapping'), Ember Data ends up looking for 'serializer:embeddSwitchPortMapping' which it doesn't find.
The IsolatedContainer doesn't normalize type keys from
oneThing
toone-thing
as the regular container would do.This is an issue because ember-data accepts relationship using camelcased model names, so configuring a test with
needs: ['model:one-thing']
and usingoneThing: DS.belongsTo('oneThing')
in a model definition will cause the resolver to crash when looking foroneThing
(throughstore.modelFor
).Based on what ember / ember-cli does, this patch fixes the issue for me, but I do not understand the resolver well enough to be confident in that change.
The text was updated successfully, but these errors were encountered: