Skip to content
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

Fix usage of owner.unregister within ember-engines tests #1216

Merged
merged 1 commit into from
May 17, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions addon-test-support/@ember/test-helpers/-internal/build-registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,24 @@ const ContainerProxyMixin = (Ember as any)._ContainerProxyMixin;

const Owner = EmberObject.extend(RegistryProxyMixin, ContainerProxyMixin, {
_emberTestHelpersMockOwner: true,

/**
* Unregister a factory and its instance.
*
* Overrides `RegistryProxy#unregister` in order to clear any cached instances
* of the unregistered factory.
*
* @param {string} fullName Name of the factory to unregister.
*
* @see {@link https://github.com/emberjs/ember.js/pull/12680}
* @see {@link https://github.com/emberjs/ember.js/blob/v4.5.0-alpha.5/packages/%40ember/engine/instance.ts#L152-L167}
*/
unregister(fullName: string) {
this.__container__.reset(fullName);

// We overwrote this method from RegistryProxyMixin.
this.__registry__.unregister(fullName);
},
});

/**
Expand Down