diff --git a/packages/compiler-core/__tests__/parse.spec.ts b/packages/compiler-core/__tests__/parse.spec.ts
index b21288d95..4b0992a5f 100644
--- a/packages/compiler-core/__tests__/parse.spec.ts
+++ b/packages/compiler-core/__tests__/parse.spec.ts
@@ -646,6 +646,55 @@ describe('compiler: parse', () => {
})
})
+ test('v-is without `isNativeTag`', () => {
+ const ast = baseParse(
+ `
`,
+ {
+ isNativeTag: tag => tag === 'div'
+ }
+ )
+
+ expect(ast.children[0]).toMatchObject({
+ type: NodeTypes.ELEMENT,
+ tag: 'div',
+ tagType: ElementTypes.ELEMENT
+ })
+
+ expect(ast.children[1]).toMatchObject({
+ type: NodeTypes.ELEMENT,
+ tag: 'div',
+ tagType: ElementTypes.COMPONENT
+ })
+
+ expect(ast.children[2]).toMatchObject({
+ type: NodeTypes.ELEMENT,
+ tag: 'Comp',
+ tagType: ElementTypes.COMPONENT
+ })
+ })
+
+ test('v-is with `isNativeTag`', () => {
+ const ast = baseParse(``)
+
+ expect(ast.children[0]).toMatchObject({
+ type: NodeTypes.ELEMENT,
+ tag: 'div',
+ tagType: ElementTypes.ELEMENT
+ })
+
+ expect(ast.children[1]).toMatchObject({
+ type: NodeTypes.ELEMENT,
+ tag: 'div',
+ tagType: ElementTypes.COMPONENT
+ })
+
+ expect(ast.children[2]).toMatchObject({
+ type: NodeTypes.ELEMENT,
+ tag: 'Comp',
+ tagType: ElementTypes.COMPONENT
+ })
+ })
+
test('custom element', () => {
const ast = baseParse('', {
isNativeTag: tag => tag === 'div',
diff --git a/packages/compiler-core/__tests__/transforms/transformElement.spec.ts b/packages/compiler-core/__tests__/transforms/transformElement.spec.ts
index 43ba48b9a..6434b51c8 100644
--- a/packages/compiler-core/__tests__/transforms/transformElement.spec.ts
+++ b/packages/compiler-core/__tests__/transforms/transformElement.spec.ts
@@ -829,6 +829,25 @@ describe('compiler: element transform', () => {
}
})
})
+
+ test('v-is', () => {
+ const { node, root } = parseWithBind(``)
+ expect(root.helpers).toContain(RESOLVE_DYNAMIC_COMPONENT)
+ expect(node).toMatchObject({
+ tag: {
+ callee: RESOLVE_DYNAMIC_COMPONENT,
+ arguments: [
+ {
+ type: NodeTypes.SIMPLE_EXPRESSION,
+ content: `'foo'`,
+ isStatic: false
+ }
+ ]
+ },
+ // should skip v-is runtime check
+ directives: undefined
+ })
+ })
})
test('