refactor(v-on): avoid empty modifier guard with only key modifier

This commit is contained in:
Evan You
2019-10-18 16:20:45 -04:00
parent d69d3bf765
commit cba34453db
7 changed files with 47 additions and 30 deletions

View File

@@ -103,4 +103,17 @@ describe('compiler-dom: transform v-on', () => {
}
})
})
it('should not wrap normal guard if there is only keys guard', () => {
const [prop] = parseVOnProperties(`<div @keyup.enter="test"/>`, {
prefixIdentifiers: true
})
expect(prop).toMatchObject({
type: NodeTypes.JS_PROPERTY,
value: {
callee: V_ON_KEYS_GUARD,
arguments: [{ content: '_ctx.test' }, '["enter"]']
}
})
})
})