-
Notifications
You must be signed in to change notification settings - Fork 111
Simulating user input #16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
The solution is to do what vue-test-utils does inside setValue: const textInput = wrapper.find('input')
textInput.value = 'test'
await fireEvent.input(textInput) This would work currently but it takes 2 lines to do what react-testing-library does in 1. A possible improvement would be to add a method to fireEvent (update?) that does both steps in 1 call? const textInput = wrapper.find('input')
await fireEvent.update(textInput, 'test') Any thoughts? |
Aaah I see, thanks Daniel, that works just fine! Yea, adding an The only thing I think would need to be considered is that vue-test-utils has three methods, Otherwise, thanks again for your work! |
Hey guys
Firstly thanks heaps for the great library :)
Just wondering if there's currently a better way to update an input bound with
v-model
instead of usingupdateState
? In this example it's mentioned that it's waiting on an issue with @vue/test-utils to be able to update v-model properly, but as far as I'm aware, vue test utils allows you to do something likeelement.trigger('change', 'newValue')
and it will update.for example, given the below:
what would be the best way to ensure that when users enter data into the input that it's updated. The above test would currently fail at the
getByText('test')
assertion. However if we used vue test utils and did something like:it would apparently pass ( see here )
updateState
does work, but it seems to kind of defeat the purpose if we're not really checking that the input is bound correctly to the model.Thanks again!
The text was updated successfully, but these errors were encountered: