Skip to content

Commit 0a353f0

Browse files
committed
test(x-mp): 添加 v-for 测试用例
1 parent f8721b5 commit 0a353f0

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

packages/uni-mp-compiler/__tests__/root.spec.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,17 @@ describe('compiler: root', () => {
157157
`(_ctx, _cache) => { "raw js"
158158
const __returned__ = _e({ a: _ctx.show }, _ctx.show ? _e({ b: _ctx.show2 }, _ctx.show2 ? { c: \`\${_ctx.u_s_b_h}px\` } : {}, { d: \`\${_ctx.u_s_b_h}px\` }) : {})
159159
return __returned__
160+
}`,
161+
{ isX: true }
162+
)
163+
})
164+
test('v-for', () => {
165+
assert(
166+
`<template v-for="item in list"><view>item -- {{ item }}</view></template>`,
167+
`<block wx:for="{{a}}" wx:for-item="item"><view style="{{'--status-bar-height:' + b}}">item -- {{item.a}}</view></block>`,
168+
`(_ctx, _cache) => { "raw js"
169+
const __returned__ = { a: _f(_ctx.list, (item, k0, i0) => { return { a: _t(item) }; }), b: \`\${_ctx.u_s_b_h}px\` }
170+
return __returned__
160171
}`,
161172
{ isX: true }
162173
)

0 commit comments

Comments
 (0)