diff --git a/packages/ember-glimmer/lib/syntax/input.ts b/packages/ember-glimmer/lib/syntax/input.ts index 40e33507a74..7bf035fa7eb 100644 --- a/packages/ember-glimmer/lib/syntax/input.ts +++ b/packages/ember-glimmer/lib/syntax/input.ts @@ -165,8 +165,8 @@ export function inputMacro(_name: string, params: Option if (Array.isArray(typeArg)) { // there is an AST plugin that converts this to an expression // it really should just compile in the component call too. - let inputTypeExpr = params.shift() as WireFormat.Expression; - builder.dynamicComponent(inputTypeExpr, params, hash, true, null, null); + let inputTypeExpr = params[0] as WireFormat.Expression; + builder.dynamicComponent(inputTypeExpr, params.slice(1), hash, true, null, null); return true; } if (typeArg === 'checkbox') { diff --git a/packages/ember-glimmer/tests/integration/helpers/input-test.js b/packages/ember-glimmer/tests/integration/helpers/input-test.js index a4c406f718d..8fa9f5f31d2 100644 --- a/packages/ember-glimmer/tests/integration/helpers/input-test.js +++ b/packages/ember-glimmer/tests/integration/helpers/input-test.js @@ -446,6 +446,22 @@ moduleFor('Helpers test: {{input}} with dynamic type', class extends InputRender this.assertAttr('type', 'text'); } + + ['@test GH16256 input macro does not modify params in place']() { + this.registerComponent('my-input', { + template: `{{input type=inputType}}` + }); + + this.render(`{{my-input inputType=firstType}}{{my-input inputType=secondType}}`, { + firstType: 'password', + secondType: 'email' + }); + + let inputs = this.element.querySelectorAll('input'); + this.assert.equal(inputs.length, 2, 'there are two inputs'); + this.assert.equal(inputs[0].getAttribute('type'), 'password'); + this.assert.equal(inputs[1].getAttribute('type'), 'email'); + } }); moduleFor(`Helpers test: {{input type='checkbox'}}`, class extends InputRenderingTest {