Skip to content

Commit da39b66

Browse files
committed
test: add test cases
1 parent bf9439d commit da39b66

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

packages/uni-mp-alipay/__tests__/vOn.spec.ts

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,47 @@ describe('mp-alipay: transform v-on', () => {
3030
`<custom onClick="{{a}}" u-i="2a9ec0b0-0" onVI="__l"/>`,
3131
`(_ctx, _cache) => {
3232
return { a: _o(_ctx.onClick) }
33+
}`
34+
)
35+
})
36+
test('event with capture modifier', () => {
37+
assert(
38+
`<view @click.capture="onClick"/>`,
39+
`<view capture-onTap="{{a}}"/>`,
40+
`(_ctx, _cache) => {
41+
return { a: _o(_ctx.onClick) }
42+
}`
43+
)
44+
})
45+
test('event with stop or prevent modifier', () => {
46+
assert(
47+
`<view @click.stop="onClick"/>`,
48+
`<view catchTap="{{a}}"/>`,
49+
`(_ctx, _cache) => {
50+
return { a: _o(_ctx.onClick) }
51+
}`
52+
)
53+
assert(
54+
`<view @click.prevent="onClick"/>`,
55+
`<view catchTap="{{a}}"/>`,
56+
`(_ctx, _cache) => {
57+
return { a: _o(_ctx.onClick) }
58+
}`
59+
)
60+
})
61+
test('event with capture modifier and stop or prevent modifier', () => {
62+
assert(
63+
`<view @touchStart.capture.stop="onClick"/>`,
64+
`<view capture-catchTouchStart="{{a}}"/>`,
65+
`(_ctx, _cache) => {
66+
return { a: _o(_ctx.onClick) }
67+
}`
68+
)
69+
assert(
70+
`<view @touchStart.capture.prevent="onClick"/>`,
71+
`<view capture-catchTouchStart="{{a}}"/>`,
72+
`(_ctx, _cache) => {
73+
return { a: _o(_ctx.onClick) }
3374
}`
3475
)
3576
})

0 commit comments

Comments
 (0)