diff --git a/packages/ember-glimmer/lib/components/text_field.js b/packages/ember-glimmer/lib/components/text_field.js index 84e0306c49d..161fac6455a 100644 --- a/packages/ember-glimmer/lib/components/text_field.js +++ b/packages/ember-glimmer/lib/components/text_field.js @@ -8,7 +8,6 @@ import Component from '../component'; import layout from '../templates/empty'; import { TextSupport } from 'ember-views'; -let inputTypeTestElement; const inputTypes = Object.create(null); function canSetTypeOfInput(type) { if (type in inputTypes) { @@ -23,9 +22,7 @@ function canSetTypeOfInput(type) { return type; } - if (!inputTypeTestElement) { - inputTypeTestElement = document.createElement('input'); - } + let inputTypeTestElement = document.createElement('input'); try { inputTypeTestElement.type = type; diff --git a/packages/ember-glimmer/tests/integration/helpers/input-test.js b/packages/ember-glimmer/tests/integration/helpers/input-test.js index 36150bb024a..aed3252c66e 100644 --- a/packages/ember-glimmer/tests/integration/helpers/input-test.js +++ b/packages/ember-glimmer/tests/integration/helpers/input-test.js @@ -425,6 +425,13 @@ moduleFor('Helpers test: {{input}}', class extends InputRenderingTest { keyCode: 65 }); } + + ['@test GH#14727 can render a file input after having had render an input of other type']() { + this.render(`{{input type="text"}}{{input type="file"}}`); + + this.assert.equal(this.$input()[0].type, 'text'); + this.assert.equal(this.$input()[1].type, 'file'); + } }); moduleFor('Helpers test: {{input}} with dynamic type', class extends InputRenderingTest {