Example of How to Simulate User Interaction With Formik
See original GitHub issueOne might (in Javascript tests, Selenium tests, bookmarklets, etc.) want to “manually” fill in a Formik input’s value. But, simply setting someInput.value = 5
(obviously) won’t work, as it doesn’t trigger Formik’s logic (and thus the old value reverts back). I tried creating a change
event and dispatching it on the affected input
, but that wasn’t enough either.
It would be really great if the documentation included a quick recipe for how to “simulate” (ie. create and dispatch) the event or events necessary to make Formik treat a manual change as if it had come from a user.
Thanks.
Issue Analytics
- State:
- Created 6 years ago
- Comments:9 (2 by maintainers)
Top Results From Across the Web
Formik - Testing Library
Example based in this Async Submission Formik example. // myForm.js ... import userEvent from '@testing-library/user-event'
Read more >Dynamic forms with Formik and React JS. - DEV Community
Technologies to be used. Creating the project. First steps. Designing the form. Implementing Formik in our form.
Read more >Tutorial - Formik
Before we start. Welcome to the Formik tutorial. This will teach you everything you need to know to build simple and complex forms...
Read more >Creating and Validating React Native Forms with Formik
Let's start by creating a simple form button component which is a touchable element that allows the user to interact with the device's...
Read more >How To Validate a Login Form With React and Formik
In this tutorial, you will create a React project, add the Formik package, customize the Formik component with an onSubmit callback and a ......
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
@machineghost which library are you using now?
Can anyone provide me an example of how to test mapPropsToValues?