Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
It is now possible to use `renderToString` to test the SSR rendering of a component. To do so, use `renderToString(MyComponent)`. `renderToString` returns a `Promise<string>` with the HTML rendered. ```ts it('returns correct html with pre-fetched data on server', async () => { const Component = defineComponent({ template: '<div>{{ text }}</div>', setup() { const text = ref<string | null>(null) onServerPrefetch(async () => { text.value = await fakeFetch('onServerPrefetch') }) return { text } } }) const contents = await renderToString(Component) expect(contents).toBe('<div>onServerPrefetch</div>') }) ```
- Loading branch information