mardi 8 décembre 2020

Unable to open a new tab using while using jasmine and vue

here i am using jasmine for testing vue js component and while testing i am getting a error like below

some your tests did a full page reload

in the component my code is like below

someFunction(){
window.open('url',_blank)
}

this is method is linked to anchor tag

In the spec file im using like this

const anchor = wrapper.find('a');
window.location.href = url;
anchor.trigger('click');
expect(window.open).toHaveBeenCalled();

So is when ever i try to open i getting the above error so how can we open it in new tab or write test case for that ?

Aucun commentaire:

Enregistrer un commentaire