Vue testing with vue-test-utils with Jest, gives errors when exec copy command
document.execCommand is not a function. How can I resolve it?
This is code snippet in component source.
copyToClipboard(){
document.execCommand('copy');
}
And here I had writen test like this;
import Vue from 'vue';
import Vuex from 'vuex';
import {shallowMount} from '@vue/test-utils'
describe('*****.vue', () => {
let wrapper;
beforeAll(()=>{
wrapper = shallowMount(***, {attachToDocument:true, store, localVue});
})
it('should render correct content', () => {
wrapper.vm.copyToClipboard();
);
}