[Vuejs]-Unit Test: How can i correctly trigger a trigger event on an input which calls a function in vuex?

0๐Ÿ‘

โœ…

I finally settled with:

 it("should call the updateSubmitDisabled mutation", () => {
  const wrapper = mount(UserForm, { localVue, store });
  const input = wrapper.get('input[name="name"]');
  input.element.dispatchEvent(new Event('input'));
  expect(mutations.updateSubmitDisabled).toHaveBeenCalled();
 });

Leave a comment