File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -615,16 +615,21 @@ method.
615
615
Usage example:
616
616
617
617
` ` ` jsx
618
- import React from ' react'
618
+ import React , { useState } from ' react'
619
619
import {render , screen } from ' @testing-library/react'
620
620
import userEvent , {specialChars } from ' @testing-library/user-event'
621
621
622
+ const InputElement = () => {
623
+ const [currentValue , setCurrentValue ] = useState (' This is a bad example' );
624
+ return < div>
625
+ < label htmlFor= ' my-input' > Example: < / label>
626
+ < input id= ' my-input' type= ' text' value= {currentValue} onChange= {(e ) => setCurrentValue (e .target .value )} / >
627
+ < / div> ;
628
+ }
629
+
622
630
test (' delete characters within the selectedRange' , () => {
623
631
render (
624
- < div>
625
- < label htmlFor= " my-input" > Example: < / label>
626
- < input id= " my-input" type= " text" value= " This is a bad example" / >
627
- < / div> ,
632
+ < InputElement/ > ,
628
633
)
629
634
const input = screen .getByLabelText (/ example/ i )
630
635
input .setSelectionRange (10 , 13 )
You can’t perform that action at this time.
0 commit comments