perf(compiler-dom): generate modifiers in a function (#459)

This commit is contained in:
Gabriel Loiácono
2019-11-15 17:37:02 -03:00
committed by Evan You
parent 159d58f09b
commit 96623d0d52
2 changed files with 59 additions and 8 deletions

View File

@@ -45,6 +45,32 @@ describe('compiler-dom: transform v-on', () => {
})
})
it('should support multiple events and modifiers options w/ prefixIdentifiers: true', () => {
const { props } = parseWithVOn(
`<div @click.stop="test" @keyup.enter="test" />`,
{
prefixIdentifiers: true
}
)
const [clickProp, keyUpProp] = props
expect(props).toHaveLength(2)
expect(clickProp).toMatchObject({
type: NodeTypes.JS_PROPERTY,
value: {
callee: V_ON_WITH_MODIFIERS,
arguments: [{ content: '_ctx.test' }, '["stop"]']
}
})
expect(keyUpProp).toMatchObject({
type: NodeTypes.JS_PROPERTY,
value: {
callee: V_ON_WITH_KEYS,
arguments: [{ content: '_ctx.test' }, '["enter"]']
}
})
})
it('should support multiple modifiers and event options w/ prefixIdentifiers: true', () => {
const {
props: [prop]