]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
test: fix tests w/ nested CompoundExpressions
authorEvan You <yyx990803@gmail.com>
Wed, 5 Feb 2020 19:30:34 +0000 (14:30 -0500)
committerEvan You <yyx990803@gmail.com>
Wed, 5 Feb 2020 19:30:34 +0000 (14:30 -0500)
packages/compiler-core/__tests__/__snapshots__/codegen.spec.ts.snap
packages/compiler-core/__tests__/codegen.spec.ts
packages/compiler-core/__tests__/transforms/vModel.spec.ts
packages/compiler-core/__tests__/transforms/vOn.spec.ts

index 4a577b76f3fb2be756c85c5034c21cca5f03939f..111b7524900b62e8f6db91ed10ce8ebd60c39fa6 100644 (file)
@@ -99,7 +99,7 @@ exports[`compiler: codegen compound expression 1`] = `
 "
 return function render() {
   with (this) {
-    return _ctx.foo + _toDisplayString(bar)
+    return _ctx.foo + _toDisplayString(bar) + nested
   }
 }"
 `;
index b360384b6a1557c93aa639ebcad38d24dfd0c745..b403479368cd6497d6945adad24d60dadbbd5aaa 100644 (file)
@@ -207,12 +207,14 @@ describe('compiler: codegen', () => {
             type: NodeTypes.INTERPOLATION,
             loc: locStub,
             content: createSimpleExpression(`bar`, false, locStub)
-          }
+          },
+          // nested compound
+          createCompoundExpression([` + `, `nested`])
         ])
       })
     )
     expect(code).toMatch(
-      `return _ctx.foo + _${helperNameMap[TO_DISPLAY_STRING]}(bar)`
+      `return _ctx.foo + _${helperNameMap[TO_DISPLAY_STRING]}(bar) + nested`
     )
     expect(code).toMatchSnapshot()
   })
index 5f2721f8d836c4ad3b1355cd941cc4f1ccfc0b38..37812852fafe987760d2756d1c37cdccfe4b1bd2 100644 (file)
@@ -191,15 +191,19 @@ describe('compiler: transform v-model', () => {
         children: [
           '$event => (',
           {
-            content: '_ctx.model',
-            isStatic: false
-          },
-          '[',
-          {
-            content: '_ctx.index',
-            isStatic: false
+            children: [
+              {
+                content: '_ctx.model',
+                isStatic: false
+              },
+              '[',
+              {
+                content: '_ctx.index',
+                isStatic: false
+              },
+              ']'
+            ]
           },
-          ']',
           ' = $event)'
         ]
       }
index 596d7352d093462d29bfc808843e69738b3fd792..3ba3c4a8182c5489714f8d19bd2856e0651dee2a 100644 (file)
@@ -168,11 +168,16 @@ describe('compiler: transform v-on', () => {
         type: NodeTypes.COMPOUND_EXPRESSION,
         children: [
           `$event => (`,
-          { content: `_ctx.foo` },
-          `(`,
-          // should NOT prefix $event
-          { content: `$event` },
-          `)`,
+          {
+            type: NodeTypes.COMPOUND_EXPRESSION,
+            children: [
+              { content: `_ctx.foo` },
+              `(`,
+              // should NOT prefix $event
+              { content: `$event` },
+              `)`
+            ]
+          },
           `)`
         ]
       }
@@ -191,13 +196,17 @@ describe('compiler: transform v-on', () => {
         type: NodeTypes.COMPOUND_EXPRESSION,
         children: [
           `$event => {`,
-          { content: `_ctx.foo` },
-          `(`,
-          // should NOT prefix $event
-          { content: `$event` },
-          `);`,
-          { content: `_ctx.bar` },
-          `()`,
+          {
+            children: [
+              { content: `_ctx.foo` },
+              `(`,
+              // should NOT prefix $event
+              { content: `$event` },
+              `);`,
+              { content: `_ctx.bar` },
+              `()`
+            ]
+          },
           `}`
         ]
       }
@@ -363,7 +372,11 @@ describe('compiler: transform v-on', () => {
         index: 1,
         value: {
           type: NodeTypes.COMPOUND_EXPRESSION,
-          children: [`$event => (`, { content: `_ctx.foo` }, `++`, `)`]
+          children: [
+            `$event => (`,
+            { children: [{ content: `_ctx.foo` }, `++`] },
+            `)`
+          ]
         }
       })
     })