File tree Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Original file line number Diff line number Diff line change @@ -519,17 +519,16 @@ If you want to trigger the
519519[ ` onChange ` ](https://reactjs.org/docs/dom-elements.html#onchange) handler of a
520520[controlled component](https://reactjs.org/docs/forms.html#controlled-components)
521521with a different ` event .target .value ` , sending ` value ` through ` eventProperties `
522- won't work like it does with ` Simulate ` . You need to change the element's
523- ` value ` property, then use ` fireEvent ` to fire a ` change ` DOM event.
522+ won't work like it does with ` Simulate ` . You need to use ` fireEvent ` to fire a
523+ ` change ` DOM event with ` value ` property set on ` target `
524524
525525` ` ` javascript
526526import {render , fireEvent } from ' react-testing-library'
527527
528528const {getByLabelText } = render (<Form />)
529529
530530const comment = getByLabelText (' Comment' )
531- comment .value = ' Great advice, I love your posts!'
532- fireEvent .change (comment )
531+ fireEvent .change (comment , { target: { value: ' Great advice, I love your posts!' })
533532` ` `
534533
535534### ` waitForElement `
You can’t perform that action at this time.
0 commit comments