1
1
// NOTE: This test is implemented based on the case of `runtime-core/__test__/componentSlots.spec.ts`.
2
2
3
3
import {
4
+ createComponent ,
4
5
defineComponent ,
5
6
getCurrentInstance ,
6
7
nextTick ,
7
8
ref ,
8
- render as renderComponent ,
9
9
template ,
10
10
} from '../src'
11
11
import { createSlots } from '../src/slot'
@@ -28,9 +28,7 @@ describe('component: slots', () => {
28
28
29
29
const { render } = define ( {
30
30
render ( ) {
31
- const t0 = template ( '<div></div>' )
32
- const n0 = t0 ( )
33
- renderComponent ( Comp , { } , slots , n0 as ParentNode )
31
+ return createComponent ( Comp , { } , slots )
34
32
} ,
35
33
} )
36
34
@@ -58,12 +56,12 @@ describe('component: slots', () => {
58
56
)
59
57
60
58
test ( 'initSlots: instance.slots should be set correctly' , ( ) => {
61
- let proxy : any
59
+ let instance : any
62
60
const { render } = define ( {
63
61
render ( ) {
64
62
const t0 = template ( '<div></div>' )
65
63
const n0 = t0 ( )
66
- proxy = getCurrentInstance ( )
64
+ instance = getCurrentInstance ( )
67
65
return n0
68
66
} ,
69
67
} )
@@ -78,7 +76,7 @@ describe('component: slots', () => {
78
76
} ,
79
77
} ) ,
80
78
)
81
- expect ( proxy . slots . header ( ) ) . toMatchObject ( [
79
+ expect ( instance . slots . header ( ) ) . toMatchObject ( [
82
80
document . createTextNode ( 'header' ) ,
83
81
] )
84
82
} )
@@ -116,9 +114,7 @@ describe('component: slots', () => {
116
114
117
115
const { render } = define ( {
118
116
render ( ) {
119
- const t0 = template ( '<div></div>' )
120
- const n0 = t0 ( )
121
- renderComponent (
117
+ return createComponent (
122
118
Child ,
123
119
{ } ,
124
120
createSlots ( {
@@ -129,9 +125,7 @@ describe('component: slots', () => {
129
125
: [ template ( '<div></div>' ) ( ) ]
130
126
} ,
131
127
} ) ,
132
- n0 as ParentNode ,
133
128
)
134
- return [ ]
135
129
} ,
136
130
} )
137
131
0 commit comments