@@ -26,7 +26,12 @@ import {
26
26
27
27
import { config } from './config'
28
28
import { GlobalMountOptions } from './types'
29
- import { isClassComponent , mergeGlobalProperties } from './utils'
29
+ import {
30
+ isClassComponent ,
31
+ isFunctionalComponent ,
32
+ isObjectComponent ,
33
+ mergeGlobalProperties
34
+ } from './utils'
30
35
import { processSlot } from './utils/compileSlots'
31
36
import { createWrapper , VueWrapper } from './vueWrapper'
32
37
import { attachEmitListener } from './emitMixin'
@@ -231,11 +236,11 @@ export function mount(
231
236
options ?: MountingOptions < any >
232
237
) : VueWrapper < any > {
233
238
// normalise the incoming component
234
- let component = originalComponent
239
+ let component
235
240
236
241
const functionalComponentEmits : Record < string , unknown [ ] > = { }
237
242
238
- if ( typeof originalComponent === 'function' && ! isClassComponent ( component ) ) {
243
+ if ( isFunctionalComponent ( originalComponent ) ) {
239
244
// we need to wrap it like this so we can capture emitted events.
240
245
// we capture events using a mixin that mutates `emit` in `beforeCreate`,
241
246
// but functional components do not support mixins, so we need to wrap it
@@ -247,6 +252,10 @@ export function mount(
247
252
)
248
253
}
249
254
} )
255
+ } else if ( isObjectComponent ( originalComponent ) ) {
256
+ component = { ...originalComponent }
257
+ } else {
258
+ component = originalComponent
250
259
}
251
260
252
261
const el = document . createElement ( 'div' )
0 commit comments