Skip to content

Commit

Permalink
fix(owner): unregister calls container.reset
Browse files Browse the repository at this point in the history
  • Loading branch information
buschtoens committed Apr 30, 2022
1 parent 7d0aab9 commit ddf200a
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 ddf200a

Please sign in to comment.