新入手vue-test-utils,想测试封装在component/tinymce/index的vue代码:
但是却直接报错说window.tinymce是undefined
有点疑惑有大神能解答吗?
import Tinymce from '@/components/Tinymce/index'
import { mount, createLocalVue, shallowMount } from '@vue/test-utils'
import Element from 'element-ui'
const localVue = createLocalVue()
localVue.use(Element)
describe('Tinymce', () => {
const wrapper = shallowMount(Tinymce, {
localVue,
attachToDocument: true
})
it('emit functions run correct by order', () => {
expect(wrapper.emittedByOrder().map(e => e.name)).toEqual(['input', 'backImgAndId'])
})
})
1条答案
按热度按时间d5vmydt91#
index.html中引入了static文件夹中的tinymce4.7.5里面的文件,<script src=<%= BASE_URL %>/tinymce4.7.5/tinymce.min.js>