1
1
/* eslint-disable testing-library/no-wait-for-empty-callback */
2
- import { createLocalVue , mount } from '@vue/test-utils'
2
+ import { mount } from '@vue/test-utils'
3
+ // import {createLocalVue, mount} from '@vue/test-utils'
3
4
4
5
import {
5
6
getQueriesForElement ,
@@ -21,35 +22,38 @@ function render(
21
22
} = { } ,
22
23
configurationCb ,
23
24
) {
25
+ // TODO: Can we simplify this by using attachTo?
24
26
const div = document . createElement ( 'div' )
25
27
const baseElement = customBaseElement || customContainer || document . body
26
28
const container = customContainer || baseElement . appendChild ( div )
27
29
28
30
const attachTo = document . createElement ( 'div' )
29
31
container . appendChild ( attachTo )
30
32
31
- const localVue = createLocalVue ( )
33
+ // const localVue = createLocalVue()
32
34
let vuexStore = null
33
35
let router = null
34
36
let additionalOptions = { }
35
37
38
+ // TODO: Fix VTL + Vuex (v4?)
36
39
if ( store ) {
37
40
const Vuex = require ( 'vuex' )
38
- localVue . use ( Vuex )
41
+ // localVue.use(Vuex)
39
42
vuexStore = new Vuex . Store ( store )
40
43
}
41
44
45
+ // TODO: Fix VTL + Vue-router(next?)
42
46
if ( routes ) {
43
47
const requiredRouter = require ( 'vue-router' )
44
48
const VueRouter = requiredRouter . default || requiredRouter
45
- localVue . use ( VueRouter )
49
+ // localVue.use(VueRouter)
46
50
router = new VueRouter ( {
47
51
routes,
48
52
} )
49
53
}
50
54
51
55
if ( configurationCb && typeof configurationCb === 'function' ) {
52
- additionalOptions = configurationCb ( localVue , vuexStore , router )
56
+ additionalOptions = configurationCb ( vuexStore , router )
53
57
}
54
58
55
59
if ( ! mountOptions . propsData && ! ! mountOptions . props ) {
@@ -58,10 +62,10 @@ function render(
58
62
}
59
63
60
64
const wrapper = mount ( TestComponent , {
61
- localVue,
62
- router,
65
+ // localVue,
66
+ // router,
67
+ // store: vuexStore,
63
68
attachTo,
64
- store : vuexStore ,
65
69
...mountOptions ,
66
70
...additionalOptions ,
67
71
} )
@@ -74,10 +78,14 @@ function render(
74
78
baseElement,
75
79
debug : ( el = baseElement ) =>
76
80
Array . isArray ( el ) ? el . forEach ( e => logDOM ( e ) ) : logDOM ( el ) ,
77
- unmount : ( ) => wrapper . destroy ( ) ,
78
- isUnmounted : ( ) => wrapper . vm . _isDestroyed ,
81
+ unmount : ( ) => wrapper . unmount ( ) ,
82
+ // isUnmounted: () => wrapper.vm._isDestroyed,
79
83
html : ( ) => wrapper . html ( ) ,
80
84
emitted : ( ) => wrapper . emitted ( ) ,
85
+
86
+ // TODO: Is this unnecessary now? No need to await for a tick because
87
+ // setProps() handles it for us now.
88
+ // We can simply expose setProps.
81
89
updateProps : _ => {
82
90
wrapper . setProps ( _ )
83
91
return waitFor ( ( ) => { } )
0 commit comments