fix(ssr): respect render function from extends/mixins in ssr (#3006)
fix #3004
This commit is contained in:
@@ -99,6 +99,46 @@ function testRender(type: string, render: typeof renderToString) {
|
||||
).toBe(`<div>hello</div>`)
|
||||
})
|
||||
|
||||
test('components using defineComponent with extends option', async () => {
|
||||
expect(
|
||||
await render(
|
||||
createApp(
|
||||
defineComponent({
|
||||
extends: {
|
||||
data() {
|
||||
return { msg: 'hello' }
|
||||
},
|
||||
render(this: any) {
|
||||
return h('div', this.msg)
|
||||
}
|
||||
}
|
||||
})
|
||||
)
|
||||
)
|
||||
).toBe(`<div>hello</div>`)
|
||||
})
|
||||
|
||||
test('components using defineComponent with mixins option', async () => {
|
||||
expect(
|
||||
await render(
|
||||
createApp(
|
||||
defineComponent({
|
||||
mixins: [
|
||||
{
|
||||
data() {
|
||||
return { msg: 'hello' }
|
||||
},
|
||||
render(this: any) {
|
||||
return h('div', this.msg)
|
||||
}
|
||||
}
|
||||
]
|
||||
})
|
||||
)
|
||||
)
|
||||
).toBe(`<div>hello</div>`)
|
||||
})
|
||||
|
||||
test('optimized components', async () => {
|
||||
expect(
|
||||
await render(
|
||||
|
||||
Reference in New Issue
Block a user