Can't use fireEvent.update on a standard input field with Vuelidate
See original GitHub issueI’m not sure if this is vuelidate related or not but fireEvent.update doesn’t seem to work on a standard input field. I can fix it by updating vue-testing-library.js to change the fireEvent.input to fireEvent.change
Such as on line 247.
case 'INPUT':
{
if (['checkbox', 'radio'].includes(type)) {
elem.checked = true;
return fireEvent.change(elem);
} else {
elem.value = value;
return fireEvent.input(elem);
}
}
to
case 'INPUT':
{
if (['checkbox', 'radio'].includes(type)) {
elem.checked = true;
return fireEvent.change(elem);
} else {
elem.value = value;
return fireEvent.change(elem);
}
}
The above change fixes the issue. Any chance we can use change instead of input. Perhaps there’s a bug with the input function.
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (10 by maintainers)
Top Results From Across the Web
Can't use `fireEvent.update` on input file · Issue #177 - GitHub
Create a component with an input file in it. Test it with fireEvent.update. Expected behavior. I expected it to accept fileList or array...
Read more >Vuelidate doesn't update 'required'-validator, when inserting ...
When using the 'required'-validator, then it doesn't update, when I insert content into a text-field. CodeSandbox: https://codesandbox.io/s/ ...
Read more >Vuelidate | A Vue.js model validation library
Simple, lightweight model-based validation for Vue.js.
Read more >Advanced usage - Vuelidate
When using useVuelidate , Vuelidate will collect all validation $errors and $silentErrors from all nested components. No need to pass any props or...
Read more >Validator (Smart GWT LGPL Edition API 13.0p (2022-12-13))
To use an applyWhen criteria the form or grid must use a DataSource . NOTE: applyWhen is not supported for "binary" fields. Server...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
#181 introduced the ability to mute the warnings
I’ll go ahead and close this one, as the changing the fired event on input/change is not desirable.
Thank you all!
yes that would be a welcome ability, to turn off the warning.