test(compiler): tests for RootNode codegen transform

This commit is contained in:
Evan You
2019-10-02 14:03:23 -04:00
parent 24bd6c27e0
commit e90b83600a
2 changed files with 122 additions and 3 deletions

View File

@@ -196,13 +196,13 @@ function finalizeRoot(root: RootNode, context: TransformContext) {
// only child is a <slot/> - it needs to be in a fragment block.
if (child.tagType === ElementTypes.SLOT) {
root.codegenNode = createBlockExpression(
[helper(FRAGMENT), `null`, child.codegenNode],
[helper(FRAGMENT), `null`, child.codegenNode!],
context
)
} else {
// turn root element into a block
root.codegenNode = createBlockExpression(
child.codegenNode.arguments,
child.codegenNode!.arguments,
context
)
}