Skip to content

Commit

Permalink
Merge pull request #1216 from buschtoens/fix-owner-unregister
Browse files Browse the repository at this point in the history
  • Loading branch information
rwjblue authored May 17, 2022
2 parents a4f7104 + ddf200a commit 49ff317
Showing 1 changed file with 18 additions and 0 deletions.
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

0 comments on commit 49ff317

Please sign in to comment.