提交 0f9d45b2 编写于 作者: fxy060608's avatar fxy060608

chore(v3): add __tests__

上级 d81a269a
......@@ -86,7 +86,11 @@ describe('codegen', () => {
)
})
it('generate v-slot', () => {
it('generate v-slot', () => {
assertCodegen(
'<view><view v-for="(el, ind) in list" :key="ind"><test-component :list="el"><template #test="{ sendList }"><view v-for="(item, index) in sendList" :key="index"></view></template></test-component></view></view>',
`with(this){return _c('view',_l((_$s(1,'f',{forItems:list})),function(el,ind,$20,$30){return _c('view',{key:_$s(1,'f',{forIndex:$20,key:ind})},[_c('test-component',{attrs:{"list":el,"_i":("2-"+$30)},scopedSlots:_u([{key:"test",fn:function({ sendList }, _svm, _si){return _l((_svm._$s((4+'-'+$30+"-"+_si),'f',{forItems:sendList})),function(item,index,$21,$31){return _c('view',{key:_svm._$s((4+'-'+$30+"-"+_si),'f',{forIndex:$21,key:index}),attrs:{"_i":(("4-"+_si)+$30+'-'+$31)}})})}}],null,true)})],1)}),0)}`
)
assertCodegen(
'<current-user v-slot="{ user }">{{ user.firstName }}</current-user>',
`with(this){return _c('current-user',{attrs:{"_i":0},scopedSlots:_u([{key:"default",fn:function({ user }, _svm, _si){return [_v((_svm._$s(("0-"+_si),'t0-0',_s(user.firstName))))]}}])})}`
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册