Skip to content

Commit e967ed1

Browse files
committed
chore: fix test
1 parent d690331 commit e967ed1

File tree

3 files changed

+8
-14
lines changed

3 files changed

+8
-14
lines changed

packages/runtime-vapor/__tests__/_utils.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export function makeRender<Component = ObjectComponent | SetupFn>(
3434
slots: Slots = {},
3535
container: string | ParentNode = '#host',
3636
) => {
37-
app = createVaporApp(component, props)
37+
app = createVaporApp(component, props, slots)
3838
instance = app.mount(container)
3939

4040
return res()

packages/runtime-vapor/__tests__/componentSlots.spec.ts

+6-12
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
// NOTE: This test is implemented based on the case of `runtime-core/__test__/componentSlots.spec.ts`.
22

33
import {
4+
createComponent,
45
defineComponent,
56
getCurrentInstance,
67
nextTick,
78
ref,
8-
render as renderComponent,
99
template,
1010
} from '../src'
1111
import { createSlots } from '../src/slot'
@@ -28,9 +28,7 @@ describe('component: slots', () => {
2828

2929
const { render } = define({
3030
render() {
31-
const t0 = template('<div></div>')
32-
const n0 = t0()
33-
renderComponent(Comp, {}, slots, n0 as ParentNode)
31+
return createComponent(Comp, {}, slots)
3432
},
3533
})
3634

@@ -58,12 +56,12 @@ describe('component: slots', () => {
5856
)
5957

6058
test('initSlots: instance.slots should be set correctly', () => {
61-
let proxy: any
59+
let instance: any
6260
const { render } = define({
6361
render() {
6462
const t0 = template('<div></div>')
6563
const n0 = t0()
66-
proxy = getCurrentInstance()
64+
instance = getCurrentInstance()
6765
return n0
6866
},
6967
})
@@ -78,7 +76,7 @@ describe('component: slots', () => {
7876
},
7977
}),
8078
)
81-
expect(proxy.slots.header()).toMatchObject([
79+
expect(instance.slots.header()).toMatchObject([
8280
document.createTextNode('header'),
8381
])
8482
})
@@ -116,9 +114,7 @@ describe('component: slots', () => {
116114

117115
const { render } = define({
118116
render() {
119-
const t0 = template('<div></div>')
120-
const n0 = t0()
121-
renderComponent(
117+
return createComponent(
122118
Child,
123119
{},
124120
createSlots({
@@ -129,9 +125,7 @@ describe('component: slots', () => {
129125
: [template('<div></div>')()]
130126
},
131127
}),
132-
n0 as ParentNode,
133128
)
134-
return []
135129
},
136130
})
137131

packages/runtime-vapor/src/apiCreateVaporApp.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export function createVaporApp(
4040

4141
mount(rootContainer): any {
4242
if (!instance) {
43-
instance = createComponentInstance(rootComponent, rootProps)
43+
instance = createComponentInstance(rootComponent, rootProps, rootSlots)
4444
setupComponent(instance)
4545
render(instance, rootContainer)
4646
return instance

0 commit comments

Comments
 (0)