fix(ssr): respect render function from extends/mixins in ssr (#3006)

fix #3004
This commit is contained in:
HcySunYang
2021-03-25 22:32:17 +08:00
committed by GitHub
parent 7fad69c260
commit 0a583d5ca2
3 changed files with 53 additions and 7 deletions

View File

@@ -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(