test-utils: setValue() is not work well

Subject of the issue

Describe your issue here.

	it("should bind value to input by v-model", async () => {
		const textInput = wrapper.find('input[type="text"]');
		await textInput.setValue("some value");
		expect(textInput.element.innerHTML).toBe("some value");
	});

Steps to reproduce

  1. run the test
  2. throw the error message to console shows:
    image image

image

Tell us how to reproduce this issue. Please provide a working and simplified example.

Expected behaviour

pass the test What should happen?

Actual behaviour

throw error as you can see What happens instead?

Possible Solution

maybe the API is deprecated but the official doc is not updated, all of above is from doc example What are the alternative solutions? Please describe what else you have considered?

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 15 (8 by maintainers)

Most upvoted comments

I think the issue is not with setValue here? We use it in pretty much all our Vue 3 projects with latest VTU and we have no issue, but we don’t use TSX.

I’m not even sure the TSX support for Vue 3 in the Vue CLI is ready. Are you using ButtonTSX somewhere in your application? Does it work without error at runtime? I wouldn’t be surprised if that was throwing the same error at runtime.