import { createApp } from 'vue'
import { renderToString } from '../src/renderToString'
describe('ssr: attr fallthrough', () => {
test('basic', async () => {
const Child = {
template: `
`
}
const Parent = {
components: { Child },
template: ``
}
const app = createApp(Parent)
expect(await renderToString(app)).toBe(``)
})
test('with v-if', async () => {
const Child = {
props: ['ok'],
template: ``
}
const Parent = {
props: ['ok'],
components: { Child },
template: ``
}
expect(await renderToString(createApp(Parent, { ok: true }))).toBe(
``
)
expect(await renderToString(createApp(Parent, { ok: false }))).toBe(
``
)
})
test('with v-model', async () => {
const Child = {
props: ['text'],
template: ``
}
const Parent = {
components: { Child },
template: ``
}
expect(await renderToString(createApp(Parent))).toBe(
``
)
})
test('with v-bind', async () => {
const Child = {
props: ['obj'],
template: ``
}
const Parent = {
components: { Child },
template: ``
}
expect(await renderToString(createApp(Parent))).toBe(
``
)
})
test('nested fallthrough', async () => {
const Child = {
props: ['id'],
template: ``
}
const Parent = {
components: { Child },
template: ``
}
// pass to parent, fallthrough to child and merge
const app = createApp(Parent, { class: 'baz' })
expect(await renderToString(app)).toBe(
``
)
})
})