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.
615615Usage example:
616616
617617` ` ` jsx
618- import React from ' react'
618+ import React , { useState } from ' react'
619619import {render , screen } from ' @testing-library/react'
620620import userEvent , {specialChars } from ' @testing-library/user-event'
621621
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+
622630test (' delete characters within the selectedRange' , () => {
623631 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/ > ,
628633 )
629634 const input = screen .getByLabelText (/ example/ i )
630635 input .setSelectionRange (10 , 13 )
You can’t perform that action at this time.
0 commit comments