]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
test: test expression transform for reserved literals
authorEvan You <yyx990803@gmail.com>
Tue, 8 Oct 2019 15:27:48 +0000 (11:27 -0400)
committerEvan You <yyx990803@gmail.com>
Tue, 8 Oct 2019 15:27:48 +0000 (11:27 -0400)
packages/compiler-core/__tests__/transforms/transformExpressions.spec.ts

index c3dff886b1b236892811518ac238359b9e1a7ea4..e4d6d24e10f20db1400d6b2db5de02b11894c681 100644 (file)
@@ -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 } }}`