import { compile } from '../src'
describe('ssr compile: suspense', () => {
test('implicit default', () => {
expect(compile(``).code).toMatchInlineSnapshot(`
"const { resolveComponent: _resolveComponent } = require(\\"vue\\")
const { ssrRenderComponent: _ssrRenderComponent, ssrRenderSuspense: _ssrRenderSuspense } = require(\\"@vue/server-renderer\\")
return function ssrRender(_ctx, _push, _parent) {
const _component_foo = _resolveComponent(\\"foo\\")
_push(_ssrRenderSuspense({
default: (_push) => {
_push(_ssrRenderComponent(_component_foo, null, null, _parent))
},
_: 1
}))
}"
`)
})
test('explicit slots', () => {
expect(
compile(`
loading...
`).code
).toMatchInlineSnapshot(`
"const { resolveComponent: _resolveComponent } = require(\\"vue\\")
const { ssrRenderComponent: _ssrRenderComponent, ssrRenderSuspense: _ssrRenderSuspense } = require(\\"@vue/server-renderer\\")
return function ssrRender(_ctx, _push, _parent) {
const _component_foo = _resolveComponent(\\"foo\\")
_push(_ssrRenderSuspense({
default: (_push) => {
_push(_ssrRenderComponent(_component_foo, null, null, _parent))
},
fallback: (_push) => {
_push(\` loading... \`)
},
_: 1
}))
}"
`)
})
})