I’m working on tests using RTL for a simple React component that wraps JsonForms. I’m using the recommended window.matchMedia object and my tests in general are working fine.
The component takes a prop with the initial data to load into the form. I verified that the form onChange fires on my test’s initial render of the component. What doesn’t work is using userEvent.type to change the value in one of my text inputs. The DOM gets updated but the form’s onChange doesn’t fire.
When a user changes form values, some buttons are enabled and that’s what I’d like to test. Most of what I’ve found involves setting a timeout to wait for the update. I tried that with no luck. Some other examples change the button states directly in the onChange but I think those pass because the onChange fires on the initial rendering of the form.