From: ysj16 <504427021@qq.com>
Date: Fri, 20 Mar 2020 15:29:44 +0000 (+0800)
Subject: perf(transform-vif): don't need to createBlock for a component (#853)
X-Git-Tag: v3.0.0-alpha.10~30
X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a3601e9fa73d10f524ed3bdf3ae44df8847c1230;p=thirdparty%2Fvuejs%2Fcore.git
perf(transform-vif): don't need to createBlock for a component (#853)
---
diff --git a/packages/compiler-core/__tests__/transforms/vIf.spec.ts b/packages/compiler-core/__tests__/transforms/vIf.spec.ts
index 35de116863..0513ff4e33 100644
--- a/packages/compiler-core/__tests__/transforms/vIf.spec.ts
+++ b/packages/compiler-core/__tests__/transforms/vIf.spec.ts
@@ -12,7 +12,8 @@ import {
SimpleExpressionNode,
ConditionalExpression,
IfConditionalExpression,
- VNodeCall
+ VNodeCall,
+ ElementTypes
} from '../../src/ast'
import { ErrorCodes } from '../../src/errors'
import { CompilerOptions, generate } from '../../src'
@@ -77,6 +78,22 @@ describe('compiler: v-if', () => {
expect(node.branches[0].children[2].type).toBe(NodeTypes.ELEMENT)
expect((node.branches[0].children[2] as ElementNode).tag).toBe(`p`)
})
+
+ test('component v-if', () => {
+ const { node } = parseWithIfTransform(`