fix(ssr): handle fallthrough attrs in ssr compile output
This commit is contained in:
@@ -65,7 +65,7 @@ describe('ssr: renderToString', () => {
|
||||
expect(
|
||||
await renderToString(
|
||||
createApp(
|
||||
defineComponent((props: {}) => {
|
||||
defineComponent(() => {
|
||||
const msg = ref('hello')
|
||||
return () => h('div', msg.value)
|
||||
})
|
||||
@@ -89,31 +89,6 @@ describe('ssr: renderToString', () => {
|
||||
).toBe(`<div>hello</div>`)
|
||||
})
|
||||
|
||||
describe('template components', () => {
|
||||
test('render', async () => {
|
||||
expect(
|
||||
await renderToString(
|
||||
createApp({
|
||||
data() {
|
||||
return { msg: 'hello' }
|
||||
},
|
||||
template: `<div>{{ msg }}</div>`
|
||||
})
|
||||
)
|
||||
).toBe(`<div>hello</div>`)
|
||||
})
|
||||
|
||||
test('handle compiler errors', async () => {
|
||||
await renderToString(createApp({ template: `<` }))
|
||||
|
||||
expect(
|
||||
'Template compilation error: Unexpected EOF in tag.\n' +
|
||||
'1 | <\n' +
|
||||
' | ^'
|
||||
).toHaveBeenWarned()
|
||||
})
|
||||
})
|
||||
|
||||
test('nested vnode components', async () => {
|
||||
const Child = {
|
||||
props: ['msg'],
|
||||
@@ -247,7 +222,7 @@ describe('ssr: renderToString', () => {
|
||||
{ msg: 'hello' },
|
||||
{
|
||||
// optimized slot using string push
|
||||
default: ({ msg }: any, push: any, p: any) => {
|
||||
default: ({ msg }: any, push: any, _p: any) => {
|
||||
push(`<span>${msg}</span>`)
|
||||
},
|
||||
// important to avoid slots being normalized
|
||||
@@ -583,4 +558,29 @@ describe('ssr: renderToString', () => {
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
describe('integration w/ compiled template', () => {
|
||||
test('render', async () => {
|
||||
expect(
|
||||
await renderToString(
|
||||
createApp({
|
||||
data() {
|
||||
return { msg: 'hello' }
|
||||
},
|
||||
template: `<div>{{ msg }}</div>`
|
||||
})
|
||||
)
|
||||
).toBe(`<div>hello</div>`)
|
||||
})
|
||||
|
||||
test('handle compiler errors', async () => {
|
||||
await renderToString(createApp({ template: `<` }))
|
||||
|
||||
expect(
|
||||
'Template compilation error: Unexpected EOF in tag.\n' +
|
||||
'1 | <\n' +
|
||||
' | ^'
|
||||
).toHaveBeenWarned()
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user