fix(runtime-core): fix resolving inheritAttrs from mixins (#3742)

fix #3741
This commit is contained in:
edison
2021-05-28 09:53:41 +08:00
committed by GitHub
parent 9b2e894017
commit d6607c9864
5 changed files with 65 additions and 21 deletions

View File

@@ -301,6 +301,34 @@ describe('attribute fallthrough', () => {
expect(root.innerHTML).toMatch(`<div>1</div>`)
})
// #3741
it('should not fallthrough with inheritAttrs: false from mixins', () => {
const Parent = {
render() {
return h(Child, { foo: 1, class: 'parent' })
}
}
const mixin = {
inheritAttrs: false
}
const Child = defineComponent({
mixins: [mixin],
props: ['foo'],
render() {
return h('div', this.foo)
}
})
const root = document.createElement('div')
document.body.appendChild(root)
render(h(Parent), root)
// should not contain class
expect(root.innerHTML).toMatch(`<div>1</div>`)
})
it('explicit spreading with inheritAttrs: false', () => {
const Parent = {
render() {