Skip to content

Commit b23854a

Browse files
committed
Identify TODOs
1 parent 70a1ed9 commit b23854a

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

src/vue-testing-library.js

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,32 +20,35 @@ function render(
2020
} = {},
2121
configurationCb,
2222
) {
23+
// TODO: Can we simplify this by using attachTo?
2324
const div = document.createElement('div')
2425
const baseElement = customBaseElement || customContainer || document.body
2526
const container = customContainer || baseElement.appendChild(div)
2627

27-
const localVue = createLocalVue()
28+
// const localVue = createLocalVue()
2829
let vuexStore = null
2930
let router = null
3031
let additionalOptions = {}
3132

33+
// TODO: Fix VTL + Vuex (v4?)
3234
if (store) {
3335
const Vuex = require('vuex')
34-
localVue.use(Vuex)
36+
// localVue.use(Vuex)
3537
vuexStore = new Vuex.Store(store)
3638
}
3739

40+
// TODO: Fix VTL + Vue-router(next?)
3841
if (routes) {
3942
const requiredRouter = require('vue-router')
4043
const VueRouter = requiredRouter.default || requiredRouter
41-
localVue.use(VueRouter)
44+
// localVue.use(VueRouter)
4245
router = new VueRouter({
4346
routes,
4447
})
4548
}
4649

4750
if (configurationCb && typeof configurationCb === 'function') {
48-
additionalOptions = configurationCb(localVue, vuexStore, router)
51+
additionalOptions = configurationCb(vuexStore, router)
4952
}
5053

5154
if (!mountOptions.propsData && !!mountOptions.props) {
@@ -54,11 +57,9 @@ function render(
5457
}
5558

5659
const wrapper = mount(TestComponent, {
57-
localVue,
58-
router,
59-
store: vuexStore,
60-
attachToDocument: true,
61-
sync: false,
60+
// router,
61+
// store: vuexStore,
62+
// attachToDocument: true,
6263
...mountOptions,
6364
...additionalOptions,
6465
})
@@ -71,10 +72,14 @@ function render(
7172
baseElement,
7273
debug: (el = baseElement) =>
7374
Array.isArray(el) ? el.forEach(e => logDOM(e)) : logDOM(el),
74-
unmount: () => wrapper.destroy(),
75-
isUnmounted: () => wrapper.vm._isDestroyed,
75+
unmount: () => wrapper.unmount(),
76+
// isUnmounted: () => wrapper.vm._isDestroyed,
7677
html: () => wrapper.html(),
7778
emitted: () => wrapper.emitted(),
79+
80+
// TODO: Is this unnecessary now? No need to await for a tick because
81+
// setProps() handles it for us now.
82+
// We can simply expose setProps.
7883
updateProps: _ => {
7984
wrapper.setProps(_)
8085
return waitFor(() => {})

0 commit comments

Comments
 (0)