fix(compiler-core): should generate HYDRATE_EVENTS flag on dynamic component that resolves to element

fix #5870
This commit is contained in:
Evan You
2022-05-17 16:39:48 +08:00
parent f811dc2b60
commit 415091b0ee
5 changed files with 45 additions and 6 deletions

View File

@@ -1053,6 +1053,21 @@ describe('compiler: element transform', () => {
genFlagText([PatchFlags.PROPS, PatchFlags.HYDRATE_EVENTS])
)
})
// #5870
test('HYDRATE_EVENTS on dynamic component', () => {
const { node } = parseWithElementTransform(
`<component :is="foo" @input="foo" />`,
{
directiveTransforms: {
on: transformOn
}
}
)
expect(node.patchFlag).toBe(
genFlagText([PatchFlags.PROPS, PatchFlags.HYDRATE_EVENTS])
)
})
})
describe('dynamic component', () => {