diff --git a/packages/@ember/-internals/glimmer/lib/components/-link-to.ts b/packages/@ember/-internals/glimmer/lib/components/-link-to.ts index 60eeea301cb..2ae57b6e124 100644 --- a/packages/@ember/-internals/glimmer/lib/components/-link-to.ts +++ b/packages/@ember/-internals/glimmer/lib/components/-link-to.ts @@ -499,12 +499,7 @@ const LinkComponent = EmberComponent.extend({ init() { this._super(...arguments); - assert( - 'You attempted to use the component within a routeless engine, this is not supported. ' + - 'If you are using the ember-engines addon, use the component instead. ' + - 'See https://ember-engines.com/docs/links for more info.', - !this._isEngine || this._engineMountPoint !== undefined - ); + this.assertLinkToOrigin(); // Map desired event name to invoke function let { eventName } = this; @@ -636,6 +631,23 @@ const LinkComponent = EmberComponent.extend({ } ), + /** + * Method to assert that LinkTo is not used inside of a routeless engine. This method is + * overridden in ember-engines link-to-external component to just be a noop, since the + * link-to-external component extends the link-to component. + * + * @method assertLinkToOrigin + * @private + */ + assertLinkToOrigin() { + assert( + 'You attempted to use the component within a routeless engine, this is not supported. ' + + 'If you are using the ember-engines addon, use the component instead. ' + + 'See https://ember-engines.com/docs/links for more info.', + !this._isEngine || this._engineMountPoint !== undefined + ); + }, + _isActive(routerState: RouterState): boolean { if (this.loading) { return false; diff --git a/tests/docs/expected.js b/tests/docs/expected.js index 33df88a6323..48245ae8c15 100644 --- a/tests/docs/expected.js +++ b/tests/docs/expected.js @@ -92,6 +92,7 @@ module.exports = { 'arrayContentWillChange', 'assert', 'assertDestroyablesDestroyed', + 'assertLinkToOrigin', 'assign', 'associateDestroyableChild', 'asyncEnd',