File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed
packages/browser/src/node/commands Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -50,7 +50,7 @@ export const keyboard: UserEventCommand<UserEvent['keyboard']> = async (
5050 throw new TypeError ( `Provider "${ context . provider . name } " does not support selecting all text` )
5151 }
5252 } ,
53- false ,
53+ true ,
5454 )
5555}
5656
Original file line number Diff line number Diff line change @@ -557,6 +557,22 @@ describe('userEvent.keyboard', async () => {
557557 ] )
558558 } )
559559
560+ test ( 'should not auto release' , async ( ) => {
561+ const spyKeydown = vi . fn ( )
562+ const spyKeyup = vi . fn ( )
563+ const button = document . createElement ( 'button' )
564+ document . body . appendChild ( button )
565+ button . addEventListener ( 'keydown' , spyKeydown )
566+ button . addEventListener ( 'keyup' , spyKeyup )
567+ button . focus ( )
568+ await userEvent . keyboard ( '{Enter>}' )
569+ expect ( spyKeydown ) . toHaveBeenCalledOnce ( )
570+ expect ( spyKeyup ) . not . toHaveBeenCalled ( )
571+ await userEvent . keyboard ( '{/Enter}' )
572+ // userEvent doesn't fire any event here, but should we?
573+ expect ( spyKeyup ) . not . toHaveBeenCalled ( )
574+ } )
575+
560576 test ( 'standalone keyboard works correctly with active input' , async ( ) => {
561577 const documentKeydown : string [ ] = [ ]
562578 const inputKeydown : string [ ] = [ ]
You can’t perform that action at this time.
0 commit comments