vue-froala-wysiwyg icon indicating copy to clipboard operation
vue-froala-wysiwyg copied to clipboard

Error in mounted hook: "TypeError: this._$element.froalaEditor is not a function" when testing using jest

Open nirajfu3e opened this issue 3 years ago • 0 comments

I am trying to run a unite test on a component that uses the froala component. Here is my setup:

// jest.setup.js
window.jQuery = require('jquery');
window.$ = require('jquery');

require('froala-editor/js/froala_editor.pkgd.min')

const localVue = createLocalVue();
localVue.use(VueFroala);

I keep getting this error:

[Vue warn]: Error in mounted hook: "TypeError: this._$element.froalaEditor is not a function"

The same setup (actual Vue instead of localVue) works fine outside the the test setup. I have tried using the Vue object rather than localVue but no luck. Also tried to remove window.jQuery = require('jquery'); but that creates other issues - also doesn't work.

Any way we can get this working with jest and vue-test-utils?

nirajfu3e avatar Feb 21 '22 11:02 nirajfu3e