feat(compiler-core): support aliasing vue: prefixed events to inline vnode hooks
This commit is contained in:
@@ -1209,12 +1209,7 @@ describe('compiler: element transform', () => {
|
||||
|
||||
test('force block for inline before-update handlers w/ children', () => {
|
||||
expect(
|
||||
parseWithElementTransform(`<div @vnode-before-update>hello</div>`).node
|
||||
.isBlock
|
||||
).toBe(true)
|
||||
|
||||
expect(
|
||||
parseWithElementTransform(`<div @vnodeBeforeUpdate>hello</div>`).node
|
||||
parseWithElementTransform(`<div @vue:before-update>hello</div>`).node
|
||||
.isBlock
|
||||
).toBe(true)
|
||||
})
|
||||
|
||||
@@ -438,6 +438,32 @@ describe('compiler: transform v-on', () => {
|
||||
})
|
||||
})
|
||||
|
||||
test('vue: prefixed events', () => {
|
||||
const { node } = parseWithVOn(
|
||||
`<div v-on:vue:mounted="onMount" @vue:before-update="onBeforeUpdate" />`
|
||||
)
|
||||
expect((node.codegenNode as VNodeCall).props).toMatchObject({
|
||||
properties: [
|
||||
{
|
||||
key: {
|
||||
content: `onVnodeMounted`
|
||||
},
|
||||
value: {
|
||||
content: `onMount`
|
||||
}
|
||||
},
|
||||
{
|
||||
key: {
|
||||
content: `onVnodeBeforeUpdate`
|
||||
},
|
||||
value: {
|
||||
content: `onBeforeUpdate`
|
||||
}
|
||||
}
|
||||
]
|
||||
})
|
||||
})
|
||||
|
||||
describe('cacheHandler', () => {
|
||||
test('empty handler', () => {
|
||||
const { root, node } = parseWithVOn(`<div v-on:click.prevent />`, {
|
||||
|
||||
Reference in New Issue
Block a user