|
|
@@ -239,11 +239,18 @@ describe('codegen', () => {
|
|
|
it('generate scoped slot with multiline v-if', () => {
|
|
|
assertCodegen(
|
|
|
'<foo><template v-if="\nshow\n" slot-scope="bar">{{ bar }}</template></foo>',
|
|
|
- `with(this){return _c('foo',{scopedSlots:_u([(\nshow\n)?{key:"default",fn:function(bar){return [_v(_s(bar))]}}:null],true)})}`
|
|
|
+ `with(this){return _c('foo',{scopedSlots:_u([{key:"default",fn:function(bar){return (\nshow\n)?[_v(_s(bar))]:undefined}}],true)})}`
|
|
|
)
|
|
|
assertCodegen(
|
|
|
'<foo><div v-if="\nshow\n" slot="foo" slot-scope="bar">{{ bar }}</div></foo>',
|
|
|
- `with(this){return _c(\'foo\',{scopedSlots:_u([(\nshow\n)?{key:"foo",fn:function(bar){return _c(\'div\',{},[_v(_s(bar))])}}:null],true)})}`
|
|
|
+ `with(this){return _c(\'foo\',{scopedSlots:_u([{key:"foo",fn:function(bar){return (\nshow\n)?_c(\'div\',{},[_v(_s(bar))]):_e()}}],true)})}`
|
|
|
+ )
|
|
|
+ })
|
|
|
+
|
|
|
+ it('generate scoped slot with new slot syntax', () => {
|
|
|
+ assertCodegen(
|
|
|
+ '<foo><template v-if="show" #default="bar">{{ bar }}</template></foo>',
|
|
|
+ `with(this){return _c('foo',{scopedSlots:_u([(show)?{key:"default",fn:function(bar){return [_v(_s(bar))]}}:null],true)})}`
|
|
|
)
|
|
|
})
|
|
|
|