parent
e6170e8ac3
commit
2d313c4d1d
|
@ -31,6 +31,12 @@ export function main() {
|
||||||
|
|
||||||
function unparse(ast: AST): string { return new Unparser().unparse(ast); }
|
function unparse(ast: AST): string { return new Unparser().unparse(ast); }
|
||||||
|
|
||||||
|
function checkInterpolation(exp: string, expected?: string) {
|
||||||
|
var ast = parseInterpolation(exp);
|
||||||
|
if (isBlank(expected)) expected = exp;
|
||||||
|
expect(unparse(ast)).toEqual(expected);
|
||||||
|
}
|
||||||
|
|
||||||
function checkBinding(exp: string, expected?: string) {
|
function checkBinding(exp: string, expected?: string) {
|
||||||
var ast = parseBinding(exp);
|
var ast = parseBinding(exp);
|
||||||
if (isBlank(expected)) expected = exp;
|
if (isBlank(expected)) expected = exp;
|
||||||
|
@ -262,6 +268,8 @@ export function main() {
|
||||||
expectBindingError("{{a.b}}")
|
expectBindingError("{{a.b}}")
|
||||||
.toThrowErrorWith('Got interpolation ({{}}) where expression was expected');
|
.toThrowErrorWith('Got interpolation ({{}}) where expression was expected');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should parse conditional expression', () => { checkBinding('a < b ? a : b'); });
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('parseTemplateBindings', () => {
|
describe('parseTemplateBindings', () => {
|
||||||
|
@ -410,6 +418,9 @@ export function main() {
|
||||||
.toThrowErrorWith(
|
.toThrowErrorWith(
|
||||||
"Parser Error: Blank expressions are not allowed in interpolated strings");
|
"Parser Error: Blank expressions are not allowed in interpolated strings");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should parse conditional expression',
|
||||||
|
() => { checkInterpolation('{{ a < b ? a : b }}'); });
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("parseSimpleBinding", () => {
|
describe("parseSimpleBinding", () => {
|
||||||
|
|
Loading…
Reference in New Issue