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
519
519
[ ` onChange ` ](https://reactjs.org/docs/dom-elements.html#onchange) handler of a
520
520
[controlled component](https://reactjs.org/docs/forms.html#controlled-components)
521
521
with 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 `
524
524
525
525
` ` ` javascript
526
526
import {render , fireEvent } from ' react-testing-library'
527
527
528
528
const {getByLabelText } = render (<Form />)
529
529
530
530
const 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!' })
533
532
` ` `
534
533
535
534
### ` waitForElement `
You can’t perform that action at this time.
0 commit comments