wip(ssr): should apply app context when rendering app instance

This commit is contained in:
Evan You
2020-01-30 12:20:23 -05:00
parent 5c2fe536dc
commit c02e7bc7d6
3 changed files with 35 additions and 5 deletions

View File

@@ -1,7 +1,28 @@
import { createApp, h, createCommentVNode, withScopeId } from 'vue'
import {
createApp,
h,
createCommentVNode,
withScopeId,
resolveComponent,
ComponentOptions
} from 'vue'
import { renderToString, renderComponent, renderSlot, escapeHtml } from '../src'
describe('ssr: renderToString', () => {
test('should apply app context', async () => {
const app = createApp({
render() {
const Foo = resolveComponent('foo') as ComponentOptions
return h(Foo)
}
})
app.component('foo', {
render: () => h('div', 'foo')
})
const html = await renderToString(app)
expect(html).toBe(`<div>foo</div>`)
})
describe('components', () => {
test('vnode components', async () => {
expect(