chore: update test

This commit is contained in:
linzhe141 2025-03-18 11:50:33 +08:00
parent f070560741
commit ee324fbc45
2 changed files with 20 additions and 0 deletions

View File

@ -0,0 +1,13 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
exports[`compiler-dom: transform v-on > should wrap both for dynamic key event w/ once modifiers 1`] = `
"const _Vue = Vue
return function render(_ctx, _cache) {
with (_ctx) {
const { toHandlerKey: _toHandlerKey, checkDynamicEvent: _checkDynamicEvent, openBlock: _openBlock, createElementBlock: _createElementBlock } = _Vue
return (_openBlock(), _createElementBlock("div", { [_checkDynamicEvent(_toHandlerKey(e),"Once")]: test }, null, 16 /* FULL_PROPS */))
}
}"
`;

View File

@ -6,6 +6,7 @@ import {
type ObjectExpression,
TO_HANDLER_KEY,
type VNodeCall,
generate,
helperNameMap,
baseParse as parse,
transform,
@ -168,6 +169,12 @@ describe('compiler-dom: transform v-on', () => {
})
})
it('should wrap both for dynamic key event w/ once modifiers', () => {
const { root: ast } = parseWithVOn(`<div @[e].once="test"/>`)
expect(generate(ast).code).toMatchSnapshot()
})
it('should not wrap normal guard if there is only keys guard', () => {
const {
props: [prop],