From f15528350e301e26be79067e43f79db1d090d5c0 Mon Sep 17 00:00:00 2001 From: Evan You Date: Tue, 8 Oct 2019 11:27:48 -0400 Subject: [PATCH] test: test expression transform for reserved literals --- .../transforms/transformExpressions.spec.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/packages/compiler-core/__tests__/transforms/transformExpressions.spec.ts b/packages/compiler-core/__tests__/transforms/transformExpressions.spec.ts index c3dff886..e4d6d24e 100644 --- a/packages/compiler-core/__tests__/transforms/transformExpressions.spec.ts +++ b/packages/compiler-core/__tests__/transforms/transformExpressions.spec.ts @@ -168,6 +168,22 @@ describe('compiler: expression transform', () => { }) }) + test('should not prefix reserved literals', () => { + function assert(exp: string) { + const node = parseWithExpressionTransform( + `{{ ${exp} }}` + ) as InterpolationNode + expect(node.content).toMatchObject({ + type: NodeTypes.SIMPLE_EXPRESSION, + content: exp + }) + } + assert(`true`) + assert(`false`) + assert(`null`) + assert(`this`) + }) + test('should not prefix id of a function declaration', () => { const node = parseWithExpressionTransform( `{{ function foo() { return bar } }}`