diff --git a/packages/ember-template-compiler/lib/plugins/transform-input-type-syntax.js b/packages/ember-template-compiler/lib/plugins/transform-input-type-syntax.js index 5292846a65e..1705551666c 100644 --- a/packages/ember-template-compiler/lib/plugins/transform-input-type-syntax.js +++ b/packages/ember-template-compiler/lib/plugins/transform-input-type-syntax.js @@ -62,6 +62,8 @@ function insertTypeHelperParameter(node, builders) { } } if (pair && pair.value.type !== 'StringLiteral') { - node.params.unshift(builders.sexpr('-input-type', [builders.path(pair.value.original, pair.loc)], null, pair.loc)); + let path = pair.value.path ? pair.value.path.original : pair.value.original; + + node.params.unshift(builders.sexpr('-input-type', [builders.path(path, pair.loc)], null, pair.loc)); } } diff --git a/packages/ember-template-compiler/tests/plugins/transform-input-type-syntax-test.js b/packages/ember-template-compiler/tests/plugins/transform-input-type-syntax-test.js new file mode 100644 index 00000000000..c07802bb209 --- /dev/null +++ b/packages/ember-template-compiler/tests/plugins/transform-input-type-syntax-test.js @@ -0,0 +1,21 @@ +import { compile } from '../../index'; + +QUnit.module('ember-template-compiler: input type syntax'); + +QUnit.test('Can compile an {{input}} helper that has a sub-expression value as its type', function() { + expect(0); + + compile(`{{input type=(if true 'password' 'text')}}`); +}); + +QUnit.test('Can compile an {{input}} helper with a string literal type', function() { + expect(0); + + compile(`{{input type='text'}}`); +}); + +QUnit.test('Can compile an {{input}} helper with a type stored in a var', function() { + expect(0); + + compile(`{{input type=_type}}`); +});