fix(sfc/scoped-style): inherit scopeId through nested HOCs with inheritAttrs: false
fix #1988
This commit is contained in:
@@ -34,7 +34,7 @@ describe('scopeId runtime support', () => {
|
||||
const root = nodeOps.createElement('div')
|
||||
render(h(App), root)
|
||||
expect(serializeInner(root)).toBe(
|
||||
`<div parent><div parent child></div></div>`
|
||||
`<div parent><div child parent></div></div>`
|
||||
)
|
||||
})
|
||||
|
||||
@@ -67,14 +67,39 @@ describe('scopeId runtime support', () => {
|
||||
// - scopeId from parent
|
||||
// - slotted scopeId (with `-s` postfix) from child (the tree owner)
|
||||
expect(serializeInner(root)).toBe(
|
||||
`<div parent child>` +
|
||||
`<div child parent>` +
|
||||
`<div parent child-s></div>` +
|
||||
// component inside slot should have:
|
||||
// - scopeId from template context
|
||||
// - slotted scopeId from slot owner
|
||||
// - its own scopeId
|
||||
`<span parent child-s child2></span>` +
|
||||
`<span child2 parent child-s></span>` +
|
||||
`</div>`
|
||||
)
|
||||
})
|
||||
|
||||
// #1988
|
||||
test('should inherit scopeId through nested HOCs with inheritAttrs: false', () => {
|
||||
const withParentId = withScopeId('parent')
|
||||
const App = {
|
||||
__scopeId: 'parent',
|
||||
render: withParentId(() => {
|
||||
return h(Child)
|
||||
})
|
||||
}
|
||||
|
||||
function Child() {
|
||||
return h(Child2, { class: 'foo' })
|
||||
}
|
||||
|
||||
function Child2() {
|
||||
return h('div')
|
||||
}
|
||||
Child2.inheritAttrs = false
|
||||
|
||||
const root = nodeOps.createElement('div')
|
||||
render(h(App), root)
|
||||
|
||||
expect(serializeInner(root)).toBe(`<div parent></div>`)
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user