fix(compiler-core/compat): fix is prop usage on components

also fix v-bind:is usage on plain element in compat mode

fix #3934
This commit is contained in:
Evan You
2021-06-21 16:16:49 -04:00
parent 4de5d24aa7
commit 08e93220f1
4 changed files with 144 additions and 57 deletions

View File

@@ -57,8 +57,9 @@ function parseWithElementTransform(
}
}
function parseWithBind(template: string) {
function parseWithBind(template: string, options?: CompilerOptions) {
return parseWithElementTransform(template, {
...options,
directiveTransforms: {
bind: transformBind
}
@@ -914,6 +915,18 @@ describe('compiler: element transform', () => {
directives: undefined
})
})
// #3934
test('normal component with is prop', () => {
const { node, root } = parseWithBind(`<custom-input is="foo" />`, {
isNativeTag: () => false
})
expect(root.helpers).toContain(RESOLVE_COMPONENT)
expect(root.helpers).not.toContain(RESOLVE_DYNAMIC_COMPONENT)
expect(node).toMatchObject({
tag: '_component_custom_input'
})
})
})
test('<svg> should be forced into blocks', () => {