Skip to content

Commit

Permalink
[BUGFIX release] Compile input type sexprs
Browse files Browse the repository at this point in the history
- Allow {{input}} with a SubExpression type
  (e.g., {{input type=(if true 'password' 'text')}})
  to be compiled.
  • Loading branch information
jaswilli committed Dec 31, 2016
1 parent 698961a commit 77202b2
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
}
Original file line number Diff line number Diff line change
@@ -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}}`);
});

0 comments on commit 77202b2

Please sign in to comment.