From 659c0bfc908605b078cd852a167edabeb4280c9f Mon Sep 17 00:00:00 2001 From: daiwei Date: Wed, 20 Nov 2024 10:20:43 +0800 Subject: [PATCH] test: add test case --- .../server-renderer/__tests__/ssrSlot.spec.ts | 34 ++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/packages/server-renderer/__tests__/ssrSlot.spec.ts b/packages/server-renderer/__tests__/ssrSlot.spec.ts index 02872274a..4cc7fd97e 100644 --- a/packages/server-renderer/__tests__/ssrSlot.spec.ts +++ b/packages/server-renderer/__tests__/ssrSlot.spec.ts @@ -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(`

1

2

`) }) + // #12438 + test('async component slot with v-if true', async () => { + const Layout = defineAsyncComponent(() => + Promise.resolve({ + template: `
default header
`, + }), + ) + const LayoutLoader = { + setup(_: any, context: any) { + return () => h(Layout, {}, context.slots) + }, + } + expect( + await renderToString( + createApp({ + components: { + LayoutLoader, + }, + template: ` + + + + + + `, + }), + ), + ).toBe(`
new header
`) + }) + // #11326 test('dynamic component slot', async () => { expect(