diff --git a/packages/@ember/-internals/glimmer/tests/integration/components/link-to/query-params-curly-test.js b/packages/@ember/-internals/glimmer/tests/integration/components/link-to/query-params-curly-test.js index 321a986e1b4..6c3c002e381 100644 --- a/packages/@ember/-internals/glimmer/tests/integration/components/link-to/query-params-curly-test.js +++ b/packages/@ember/-internals/glimmer/tests/integration/components/link-to/query-params-curly-test.js @@ -69,7 +69,7 @@ moduleFor( '{{link-to}} component with query params (routing)', class extends ApplicationTestCase { constructor() { - super(); + super(...arguments); let indexProperties = { foo: '123', bar: 'abc', @@ -736,5 +736,36 @@ moduleFor( this.shouldBeActive(assert, '#foos-link'); }); } + + ['@test [GH#17869] it does not cause shadowing assertion with `hash` local variable']() { + this.router.map(function() { + this.route('post', { path: '/post/:id' }); + }); + + this.add( + 'controller:post', + Controller.extend({ + queryParams: ['showComments'], + showComments: true, + }) + ); + + this.addTemplate( + 'index', + ` + {{#let (hash id="1" title="Hello World!" body="Lorem ipsum dolor sit amet...") as |hash|}} + {{#link-to "post" hash (query-params showComments=false)}}View Post{{/link-to}} + {{/let}} + ` + ); + + return this.visit('/').then(() => { + this.assertComponentElement(this.element.firstElementChild, { + tagName: 'a', + attrs: { href: '/post/1?showComments=false', class: classMatcher('ember-view') }, + content: 'View Post', + }); + }); + } } ); diff --git a/packages/ember-template-compiler/lib/plugins/index.ts b/packages/ember-template-compiler/lib/plugins/index.ts index 6667b39c4bc..dbd5f1aff36 100644 --- a/packages/ember-template-compiler/lib/plugins/index.ts +++ b/packages/ember-template-compiler/lib/plugins/index.ts @@ -23,7 +23,6 @@ export type APluginFunc = (env: ASTPluginEnvironment) => ASTPlugin | undefined; const transforms: Array = [ TransformComponentInvocation, - TransformLinkTo, TransformOldClassBindingSyntax, TransformQuotedBindingsIntoJustBindings, AssertReservedNamedArguments, @@ -32,6 +31,7 @@ const transforms: Array = [ TransformEachInIntoEach, TransformHasBlockSyntax, AssertLocalVariableShadowingHelperInvocation, + TransformLinkTo, AssertInputHelperWithoutBlock, TransformInElement, AssertIfHelperWithoutArguments,