vue-element-admin 封装的tinymce组件要写vue-test-utils的时候报“Cannot read property 'init' of undefined”该如何修改呢

omhiaaxx  于 2022-10-24  发布在  其他
关注(0)|答案(1)|浏览(356)

新入手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'])
  })
})
d5vmydt9

d5vmydt91#

index.html中引入了static文件夹中的tinymce4.7.5里面的文件,<script src=<%= BASE_URL %>/tinymce4.7.5/tinymce.min.js>

相关问题