Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | 11x 11x 11x 11x 3x 3x 3x 11x 1x 1x 1x 11x 1x 11x 11x 11x 1x 1x 1x 1x 1x | import { createLocalVue, mount } from '@vue/test-utils' import Simulate from './Simulate' import { bindElementToQueries, fireEvent, wait, queries } from 'dom-testing-library' function render (TestComponent, { props = null, store = null, routes = null } = {}, configurationCb) { const localVue = createLocalVue() let vuexStore = null let router = null if (store) { const Vuex = require('vuex') localVue.use(Vuex) vuexStore = new Vuex.Store(store) } if (routes) { const VueRouter = require('vue-router') localVue.use(VueRouter) router = new VueRouter(routes) } if (configurationCb && typeof configurationCb === 'function') { configurationCb(localVue) } const wrapper = mount(TestComponent, { localVue, router, store: vuexStore, propsData: { ...props }, attachToDocument: true }) const wrapperHelpers = bindElementToQueries(wrapper.element) return { unmount: () => wrapper.destroy(), isUnmounted: () => wrapper.vm._isDestroyed, html: () => wrapper.html(), updateProps: _ => wrapper.setProps(_), updateState: _ => wrapper.setData(_), ...wrapperHelpers } } export { render, wait, fireEvent, Simulate } |