@@ -157,6 +157,53 @@ 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 ( 'slot' , ( ) => {
165+ assert (
166+ `<slot>test</slot>` ,
167+ `<block wx:if="{{$slots.d}}"><slot></slot></block><block wx:else>test</block>` ,
168+ `(_ctx, _cache) => { "raw js"
169+ const __returned__ = {}
170+ return __returned__
171+ }` ,
172+ { isX : true }
173+ )
174+ assert (
175+ `<slot><view>test</view></slot>` ,
176+ `<block wx:if="{{$slots.d}}"><slot></slot></block><block wx:else><view style="{{'--status-bar-height:' + a}}">test</view></block>` ,
177+ `(_ctx, _cache) => { "raw js"
178+ const __returned__ = { a: \`\${_ctx.u_s_b_h}px\` }
179+ return __returned__
180+ }` ,
181+ { isX : true }
182+ )
183+ assert (
184+ `<slot>test1<view>test2</view></slot>` ,
185+ `<block wx:if="{{$slots.d}}"><slot></slot></block><block wx:else>test1<view style="{{'--status-bar-height:' + a}}">test2</view></block>` ,
186+ `(_ctx, _cache) => { "raw js"
187+ const __returned__ = { a: \`\${_ctx.u_s_b_h}px\` }
188+ return __returned__
189+ }` ,
190+ { isX : true }
191+ )
192+ assert (
193+ `<slot>test1</slot><view>test2</view>` ,
194+ `<block wx:if="{{$slots.d}}"><slot></slot></block><block wx:else>test1</block><view style="{{'--status-bar-height:' + a}}">test2</view>` ,
195+ `(_ctx, _cache) => { "raw js"
196+ const __returned__ = { a: \`\${_ctx.u_s_b_h}px\` }
197+ return __returned__
198+ }` ,
199+ { isX : true }
200+ )
201+ assert (
202+ `<slot name="test">test1</slot>` ,
203+ `<block wx:if="{{$slots.test}}"><slot name="test"></slot></block><block wx:else>test1</block>` ,
204+ `(_ctx, _cache) => { "raw js"
205+ const __returned__ = {}
206+ return __returned__
160207}` ,
161208 { isX : true }
162209 )
0 commit comments