-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FEATURE ember-container-inject-owner] Inject fake container with deprecations. #12609
Conversation
Let's use the id and URL that was in the deprecation being removed here (I have already linked that url up with a decent deprecation guide entry). |
Also, I think we should leave the current deprecation (on property getter for 'container'). The fake container will only be used during instantiation of objects that do not have an .extend (as all of those that do have already had the getter added). |
Sounds good, @rwjblue. I'll make those changes. Would you also prefer that the FakeContainer not proxy through to the owner's equivalent methods, but instead just proxy through to the container's methods? Otherwise accessing |
Yes, but if the I think the changes to the PR would be (only noting them because I just traced the various pathways):
|
@@ -535,6 +535,39 @@ if (isEnabled('ember-container-inject-owner')) { | |||
strictEqual(c, container); | |||
}, 'Using the injected `container` is deprecated. Please use the `getOwner` helper instead to access the owner of this object.'); | |||
}); | |||
|
|||
QUnit.test('A deprecated `container` property is appended to every object instantiated from a non-extendable factory, and a fake container is available during instantiation.', function() { | |||
let registry = new Registry(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add expect(5)
here (just to ensure that all the expectations are firing)?
…extendable factories. The fake container is required to provide access to the `container` during instantiation of objects by non-extendable factories. The fake container provides access to the following methods: * `lookup` * `lookupFactory` Deprecation warnings are provided that direct the user to call `getOwner` followed by the equivalent `ContainerProxy` methods (`lookup` and `_lookupFactory`) on the owner.
@rwjblue ok, just implemented your suggestions |
[FEATURE ember-container-inject-owner] Inject fake container with deprecations.
The fake container provides access to the following methods:
lookup
lookupFactory
These methods are mapped through the equivalent
ContainerProxy
methods(
lookup
and_lookupFactory
) on the container's owner.Deprecation warnings are provided.
TBD: deprecation id and url