File tree Expand file tree Collapse file tree 1 file changed +33
-1
lines changed
packages/server-renderer/__tests__ Expand file tree Collapse file tree 1 file changed +33
-1
lines changed Original file line number Diff line number Diff line change 1
- import { createApp } from 'vue'
1
+ import { createApp , defineAsyncComponent , h } from 'vue'
2
2
import { renderToString } from '../src/renderToString'
3
3
4
4
const components = {
@@ -154,6 +154,38 @@ describe('ssr: slot', () => {
154
154
) . toBe ( `<div><p>1</p><p>2</p></div>` )
155
155
} )
156
156
157
+ // #12438
158
+ test ( 'async component slot with v-if true' , async ( ) => {
159
+ const Layout = defineAsyncComponent ( ( ) =>
160
+ Promise . resolve ( {
161
+ template : `<div><slot name="header">default header</slot></div>` ,
162
+ } ) ,
163
+ )
164
+ const LayoutLoader = {
165
+ setup ( _ : any , context : any ) {
166
+ return ( ) => h ( Layout , { } , context . slots )
167
+ } ,
168
+ }
169
+ expect (
170
+ await renderToString (
171
+ createApp ( {
172
+ components : {
173
+ LayoutLoader,
174
+ } ,
175
+ template : `
176
+ <Suspense>
177
+ <LayoutLoader>
178
+ <template v-if="true" #header>
179
+ new header
180
+ </template>
181
+ </LayoutLoader>
182
+ </Suspense>
183
+ ` ,
184
+ } ) ,
185
+ ) ,
186
+ ) . toBe ( `<div><!--[--> new header <!--]--></div>` )
187
+ } )
188
+
157
189
// #11326
158
190
test ( 'dynamic component slot' , async ( ) => {
159
191
expect (
You can’t perform that action at this time.
0 commit comments