Skip to content

[v4] Submit Form with vue-test-utils #3159

Answered by Fubinator
Fubinator asked this question in Q&A
Discussion options

You must be logged in to vote

I have just updated vee-validate. Now the createComment function is called when the form is correctly filled. The ErrorMessage is unfortunately not displayed to me only in case of failed validation. Unfortunately, the ErrorMessage is still not displayed in case of failed validation. However, I should be able to work with that.

edit:

using flushPromises instead of nextTick does the trick:

test("Should display the validation error message", async () => {
  const wrapper = mount(CommentSection, {});

  const button = wrapper.find("#form");

  await button.trigger("submit");
  await flushPromises();

  expect(wrapper.html()).toContain("Please enter a comment");
});

test("Should invoke the cr…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@logaretm
Comment options

Answer selected by Fubinator
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants