refactor(compiler-core): improve template type handling
This commit is contained in:
@@ -526,7 +526,6 @@ describe('compiler: parse', () => {
|
||||
tagType: ElementTypes.ELEMENT,
|
||||
codegenNode: undefined,
|
||||
props: [],
|
||||
|
||||
isSelfClosing: false,
|
||||
children: [],
|
||||
loc: {
|
||||
@@ -583,6 +582,24 @@ describe('compiler: parse', () => {
|
||||
})
|
||||
})
|
||||
|
||||
test('template element with directives', () => {
|
||||
const ast = baseParse('<template v-if="ok"></template>')
|
||||
const element = ast.children[0]
|
||||
expect(element).toMatchObject({
|
||||
type: NodeTypes.ELEMENT,
|
||||
tagType: ElementTypes.TEMPLATE
|
||||
})
|
||||
})
|
||||
|
||||
test('template element without directives', () => {
|
||||
const ast = baseParse('<template></template>')
|
||||
const element = ast.children[0]
|
||||
expect(element).toMatchObject({
|
||||
type: NodeTypes.ELEMENT,
|
||||
tagType: ElementTypes.ELEMENT
|
||||
})
|
||||
})
|
||||
|
||||
test('native element with `isNativeTag`', () => {
|
||||
const ast = baseParse('<div></div><comp></comp><Comp></Comp>', {
|
||||
isNativeTag: tag => tag === 'div'
|
||||
|
||||
Reference in New Issue
Block a user