mirror of
https://github.com/vuejs/core.git
synced 2024-11-21 20:28:45 +00:00
test: add test case
This commit is contained in:
parent
12fef2d57a
commit
659c0bfc90
@ -1,4 +1,4 @@
|
||||
import { createApp } from 'vue'
|
||||
import { createApp, defineAsyncComponent, h } from 'vue'
|
||||
import { renderToString } from '../src/renderToString'
|
||||
|
||||
const components = {
|
||||
@ -154,6 +154,38 @@ describe('ssr: slot', () => {
|
||||
).toBe(`<div><p>1</p><p>2</p></div>`)
|
||||
})
|
||||
|
||||
// #12438
|
||||
test('async component slot with v-if true', async () => {
|
||||
const Layout = defineAsyncComponent(() =>
|
||||
Promise.resolve({
|
||||
template: `<div><slot name="header">default header</slot></div>`,
|
||||
}),
|
||||
)
|
||||
const LayoutLoader = {
|
||||
setup(_: any, context: any) {
|
||||
return () => h(Layout, {}, context.slots)
|
||||
},
|
||||
}
|
||||
expect(
|
||||
await renderToString(
|
||||
createApp({
|
||||
components: {
|
||||
LayoutLoader,
|
||||
},
|
||||
template: `
|
||||
<Suspense>
|
||||
<LayoutLoader>
|
||||
<template v-if="true" #header>
|
||||
new header
|
||||
</template>
|
||||
</LayoutLoader>
|
||||
</Suspense>
|
||||
`,
|
||||
}),
|
||||
),
|
||||
).toBe(`<div><!--[--> new header <!--]--></div>`)
|
||||
})
|
||||
|
||||
// #11326
|
||||
test('dynamic component slot', async () => {
|
||||
expect(
|
||||
|
Loading…
Reference in New Issue
Block a user