diff --git a/packages/server-renderer/__tests__/ssrSlot.spec.ts b/packages/server-renderer/__tests__/ssrSlot.spec.ts new file mode 100644 index 00000000..a68569ca --- /dev/null +++ b/packages/server-renderer/__tests__/ssrSlot.spec.ts @@ -0,0 +1,86 @@ +/** + * @jest-environment node + */ + +import { createApp } from 'vue' +import { renderToString } from '../src/renderToString' + +const components = { + one: { + template: `
` + } +} + +describe('ssr: slot', () => { + test('text slot', async () => { + expect( + await renderToString( + createApp({ + components, + template: `hello` + }) + ) + ).toBe(`
hello
`) + }) + + test('element slot', async () => { + expect( + await renderToString( + createApp({ + components, + template: `
hi
` + }) + ) + ).toBe(`
hi
`) + }) + + test('empty slot', async () => { + expect( + await renderToString( + createApp({ + components: { + one: { + template: `
` + } + }, + template: `