test: fix resolveAssets test + test resolveDynamicComponent in slots
This commit is contained in:
parent
4dc8ffc378
commit
eb5b32fead
@ -6,7 +6,7 @@ import {
|
|||||||
Component,
|
Component,
|
||||||
Directive,
|
Directive,
|
||||||
resolveDynamicComponent,
|
resolveDynamicComponent,
|
||||||
getCurrentInstance
|
h
|
||||||
} from '@vue/runtime-test'
|
} from '@vue/runtime-test'
|
||||||
import { mockWarn } from '@vue/shared'
|
import { mockWarn } from '@vue/shared'
|
||||||
|
|
||||||
@ -100,14 +100,23 @@ describe('resolveAssets', () => {
|
|||||||
baz: { render: () => 'baz' }
|
baz: { render: () => 'baz' }
|
||||||
}
|
}
|
||||||
let foo, bar, baz // dynamic components
|
let foo, bar, baz // dynamic components
|
||||||
|
|
||||||
|
const Child = {
|
||||||
|
render(this: any) {
|
||||||
|
return this.$slots.default()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const Root = {
|
const Root = {
|
||||||
components: { foo: dynamicComponents.foo },
|
components: { foo: dynamicComponents.foo },
|
||||||
setup() {
|
setup() {
|
||||||
const instance = getCurrentInstance()!
|
|
||||||
return () => {
|
return () => {
|
||||||
foo = resolveDynamicComponent('foo', instance) // <component is="foo"/>
|
foo = resolveDynamicComponent('foo') // <component is="foo"/>
|
||||||
bar = resolveDynamicComponent(dynamicComponents.bar, instance) // <component :is="bar"/>, function
|
bar = resolveDynamicComponent(dynamicComponents.bar) // <component :is="bar"/>, function
|
||||||
baz = resolveDynamicComponent(dynamicComponents.baz, instance) // <component :is="baz"/>, object
|
return h(Child, () => {
|
||||||
|
// check inside child slots
|
||||||
|
baz = resolveDynamicComponent(dynamicComponents.baz) // <component :is="baz"/>, object
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user