many-holiday-68742
03/10/2023, 4:20 AMts
import { mount } from 'cypress/react18';
const onChange = cy
.stub()
.as('onChange')
.callsFake(moo => {
console.log('onChange called', moo);
});
mount(
<input type="text" data-testid="moo" onChange={onChange} />,
);
cy.get('[data-testid="moo"]').invoke('val', 'how now brown cow');
This test succeeds in updating the input's current value, but does not trigger React's onChange event. 😦
Is there a way to update the input's value, and also trigger React's onChange event at the same time?gray-kilobyte-89541
03/10/2023, 11:39 AM