@@ -78,7 +78,9 @@ it('Moves the focus to the first menu item after pressing enter while focused on
78
78
79
79
expect ( screen . getByText ( 'Primary' ) ) . toHaveFocus ( ) ;
80
80
81
- await user . keyboard ( '{Enter}' ) ;
81
+ await user . type ( screen . getByText ( 'Primary' ) , '{Enter}' , {
82
+ skipClick : true ,
83
+ } ) ;
82
84
83
85
expect ( screen . getByText ( '1 Item' ) ) . toHaveFocus ( ) ;
84
86
} ) ;
@@ -90,7 +92,9 @@ it('Moves the focus to the first menu item after pressing space while focused on
90
92
91
93
expect ( screen . getByText ( 'Primary' ) ) . toHaveFocus ( ) ;
92
94
93
- await user . keyboard ( '{ }' ) ;
95
+ await user . type ( screen . getByText ( 'Primary' ) , '{ }' , {
96
+ skipClick : true ,
97
+ } ) ;
94
98
95
99
expect ( screen . getByText ( '1 Item' ) ) . toHaveFocus ( ) ;
96
100
} ) ;
@@ -185,7 +189,7 @@ it('Moves the focus to the next element in the menu after pressing the down arro
185
189
186
190
await user . tab ( ) ;
187
191
188
- await user . type ( screen . getByText ( 'Primary' ) , '{enter }' , {
192
+ await user . type ( screen . getByText ( 'Primary' ) , '{Enter }' , {
189
193
skipClick : true ,
190
194
} ) ;
191
195
@@ -208,7 +212,7 @@ it('Moves the focus to the previous element in the menu after pressing the up ar
208
212
209
213
await user . tab ( ) ;
210
214
211
- await user . type ( screen . getByText ( 'Primary' ) , '{enter }' , {
215
+ await user . type ( screen . getByText ( 'Primary' ) , '{Enter }' , {
212
216
skipClick : true ,
213
217
} ) ;
214
218
@@ -242,7 +246,7 @@ it('Wraps the focus to the last element when pressing the up arrow at the beginn
242
246
243
247
await user . tab ( ) ;
244
248
245
- await user . type ( screen . getByText ( 'Primary' ) , '{enter }' , {
249
+ await user . type ( screen . getByText ( 'Primary' ) , '{Enter }' , {
246
250
skipClick : true ,
247
251
} ) ;
248
252
@@ -265,7 +269,7 @@ it('Wraps the focus to the first element when pressing the down arrow at the end
265
269
266
270
await user . tab ( ) ;
267
271
268
- await user . type ( screen . getByText ( 'Primary' ) , '{enter }' , {
272
+ await user . type ( screen . getByText ( 'Primary' ) , '{Enter }' , {
269
273
skipClick : true ,
270
274
} ) ;
271
275
@@ -299,7 +303,7 @@ it('Sets isOpen to false after pressing escape while focused on a menu item', as
299
303
300
304
await user . tab ( ) ;
301
305
302
- await user . type ( screen . getByText ( 'Primary' ) , '{enter }' , {
306
+ await user . type ( screen . getByText ( 'Primary' ) , '{Enter }' , {
303
307
skipClick : true ,
304
308
} ) ;
305
309
@@ -315,7 +319,7 @@ it('Sets isOpen to false after pressing tab while focused on a menu item', async
315
319
316
320
await user . tab ( ) ;
317
321
318
- await user . type ( screen . getByText ( 'Primary' ) , '{enter }' , {
322
+ await user . type ( screen . getByText ( 'Primary' ) , '{Enter }' , {
319
323
skipClick : true ,
320
324
} ) ;
321
325
@@ -329,7 +333,7 @@ it('Moves the focus to the menu button after pressing escape while focused on a
329
333
330
334
await user . tab ( ) ;
331
335
332
- await user . type ( screen . getByText ( 'Primary' ) , '{enter }' , {
336
+ await user . type ( screen . getByText ( 'Primary' ) , '{Enter }' , {
333
337
skipClick : true ,
334
338
} ) ;
335
339
@@ -437,7 +441,7 @@ it('Ignores keys that items don’t need to handle', async () => {
437
441
438
442
await user . tab ( ) ;
439
443
440
- await user . type ( screen . getByText ( 'Primary' ) , '{enter }' , {
444
+ await user . type ( screen . getByText ( 'Primary' ) , '{Enter }' , {
441
445
skipClick : true ,
442
446
} ) ;
443
447
@@ -453,11 +457,11 @@ it('Doesn’t crash when enter press occurs on a menu item', async () => {
453
457
454
458
await user . tab ( ) ;
455
459
456
- await user . type ( screen . getByText ( 'Primary' ) , '{enter }' , {
460
+ await user . type ( screen . getByText ( 'Primary' ) , '{Enter }' , {
457
461
skipClick : true ,
458
462
} ) ;
459
463
460
- user . type ( screen . getByText ( '1 Item' ) , '{enter }' , {
464
+ user . type ( screen . getByText ( '1 Item' ) , '{Enter }' , {
461
465
skipClick : true ,
462
466
} ) ;
463
467
} ) ;
@@ -467,11 +471,11 @@ it('Closes the menu after pressing enter on a menu item with a click handler', a
467
471
468
472
await user . tab ( ) ;
469
473
470
- await user . type ( screen . getByText ( 'Primary' ) , '{enter }' , {
474
+ await user . type ( screen . getByText ( 'Primary' ) , '{Enter }' , {
471
475
skipClick : true ,
472
476
} ) ;
473
477
474
- await user . type ( screen . getByText ( '1 Item' ) , '{enter }' , {
478
+ await user . type ( screen . getByText ( '1 Item' ) , '{Enter }' , {
475
479
skipClick : true ,
476
480
} ) ;
477
481
@@ -485,11 +489,11 @@ it('Activates the click handler of a menu item after pressing enter while focuse
485
489
486
490
await user . tab ( ) ;
487
491
488
- await user . type ( screen . getByText ( 'Primary' ) , '{enter }' , {
492
+ await user . type ( screen . getByText ( 'Primary' ) , '{Enter }' , {
489
493
skipClick : true ,
490
494
} ) ;
491
495
492
- await user . type ( screen . getByText ( '1 Item' ) , '{enter }' , {
496
+ await user . type ( screen . getByText ( '1 Item' ) , '{Enter }' , {
493
497
skipClick : true ,
494
498
} ) ;
495
499
@@ -501,7 +505,7 @@ it('Closes the menu after pressing space on a menu item with a click handler', a
501
505
502
506
await user . tab ( ) ;
503
507
504
- await user . type ( screen . getByText ( 'Primary' ) , '{enter }' , {
508
+ await user . type ( screen . getByText ( 'Primary' ) , '{Enter }' , {
505
509
skipClick : true ,
506
510
} ) ;
507
511
@@ -519,7 +523,7 @@ it('Activates the click handler of a menu item after pressing space while focuse
519
523
520
524
await user . tab ( ) ;
521
525
522
- await user . type ( screen . getByText ( 'Primary' ) , '{enter }' , {
526
+ await user . type ( screen . getByText ( 'Primary' ) , '{Enter }' , {
523
527
skipClick : true ,
524
528
} ) ;
525
529
@@ -535,7 +539,7 @@ it('Moves the focus to the menu item with a label that starts with the correspon
535
539
536
540
await user . tab ( ) ;
537
541
538
- await user . type ( screen . getByText ( 'Primary' ) , '{enter }' , {
542
+ await user . type ( screen . getByText ( 'Primary' ) , '{Enter }' , {
539
543
skipClick : true ,
540
544
} ) ;
541
545
@@ -551,7 +555,7 @@ it('Moves the focus to the provided menu item when `moveFocus` is called', async
551
555
552
556
await user . tab ( ) ;
553
557
554
- await user . type ( screen . getByText ( 'Primary' ) , '{enter }' , {
558
+ await user . type ( screen . getByText ( 'Primary' ) , '{Enter }' , {
555
559
skipClick : true ,
556
560
} ) ;
557
561
0 commit comments