Skip to content

Commit 7b0369d

Browse files
committed
corrected some casing issues
1 parent 13ffdc2 commit 7b0369d

File tree

1 file changed

+24
-20
lines changed

1 file changed

+24
-20
lines changed

src/use-dropdown-menu.test.tsx

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,9 @@ it('Moves the focus to the first menu item after pressing enter while focused on
7878

7979
expect(screen.getByText('Primary')).toHaveFocus();
8080

81-
await user.keyboard('{Enter}');
81+
await user.type(screen.getByText('Primary'), '{Enter}', {
82+
skipClick: true,
83+
});
8284

8385
expect(screen.getByText('1 Item')).toHaveFocus();
8486
});
@@ -90,7 +92,9 @@ it('Moves the focus to the first menu item after pressing space while focused on
9092

9193
expect(screen.getByText('Primary')).toHaveFocus();
9294

93-
await user.keyboard('{ }');
95+
await user.type(screen.getByText('Primary'), '{ }', {
96+
skipClick: true,
97+
});
9498

9599
expect(screen.getByText('1 Item')).toHaveFocus();
96100
});
@@ -185,7 +189,7 @@ it('Moves the focus to the next element in the menu after pressing the down arro
185189

186190
await user.tab();
187191

188-
await user.type(screen.getByText('Primary'), '{enter}', {
192+
await user.type(screen.getByText('Primary'), '{Enter}', {
189193
skipClick: true,
190194
});
191195

@@ -208,7 +212,7 @@ it('Moves the focus to the previous element in the menu after pressing the up ar
208212

209213
await user.tab();
210214

211-
await user.type(screen.getByText('Primary'), '{enter}', {
215+
await user.type(screen.getByText('Primary'), '{Enter}', {
212216
skipClick: true,
213217
});
214218

@@ -242,7 +246,7 @@ it('Wraps the focus to the last element when pressing the up arrow at the beginn
242246

243247
await user.tab();
244248

245-
await user.type(screen.getByText('Primary'), '{enter}', {
249+
await user.type(screen.getByText('Primary'), '{Enter}', {
246250
skipClick: true,
247251
});
248252

@@ -265,7 +269,7 @@ it('Wraps the focus to the first element when pressing the down arrow at the end
265269

266270
await user.tab();
267271

268-
await user.type(screen.getByText('Primary'), '{enter}', {
272+
await user.type(screen.getByText('Primary'), '{Enter}', {
269273
skipClick: true,
270274
});
271275

@@ -299,7 +303,7 @@ it('Sets isOpen to false after pressing escape while focused on a menu item', as
299303

300304
await user.tab();
301305

302-
await user.type(screen.getByText('Primary'), '{enter}', {
306+
await user.type(screen.getByText('Primary'), '{Enter}', {
303307
skipClick: true,
304308
});
305309

@@ -315,7 +319,7 @@ it('Sets isOpen to false after pressing tab while focused on a menu item', async
315319

316320
await user.tab();
317321

318-
await user.type(screen.getByText('Primary'), '{enter}', {
322+
await user.type(screen.getByText('Primary'), '{Enter}', {
319323
skipClick: true,
320324
});
321325

@@ -329,7 +333,7 @@ it('Moves the focus to the menu button after pressing escape while focused on a
329333

330334
await user.tab();
331335

332-
await user.type(screen.getByText('Primary'), '{enter}', {
336+
await user.type(screen.getByText('Primary'), '{Enter}', {
333337
skipClick: true,
334338
});
335339

@@ -437,7 +441,7 @@ it('Ignores keys that items don’t need to handle', async () => {
437441

438442
await user.tab();
439443

440-
await user.type(screen.getByText('Primary'), '{enter}', {
444+
await user.type(screen.getByText('Primary'), '{Enter}', {
441445
skipClick: true,
442446
});
443447

@@ -453,11 +457,11 @@ it('Doesn’t crash when enter press occurs on a menu item', async () => {
453457

454458
await user.tab();
455459

456-
await user.type(screen.getByText('Primary'), '{enter}', {
460+
await user.type(screen.getByText('Primary'), '{Enter}', {
457461
skipClick: true,
458462
});
459463

460-
user.type(screen.getByText('1 Item'), '{enter}', {
464+
user.type(screen.getByText('1 Item'), '{Enter}', {
461465
skipClick: true,
462466
});
463467
});
@@ -467,11 +471,11 @@ it('Closes the menu after pressing enter on a menu item with a click handler', a
467471

468472
await user.tab();
469473

470-
await user.type(screen.getByText('Primary'), '{enter}', {
474+
await user.type(screen.getByText('Primary'), '{Enter}', {
471475
skipClick: true,
472476
});
473477

474-
await user.type(screen.getByText('1 Item'), '{enter}', {
478+
await user.type(screen.getByText('1 Item'), '{Enter}', {
475479
skipClick: true,
476480
});
477481

@@ -485,11 +489,11 @@ it('Activates the click handler of a menu item after pressing enter while focuse
485489

486490
await user.tab();
487491

488-
await user.type(screen.getByText('Primary'), '{enter}', {
492+
await user.type(screen.getByText('Primary'), '{Enter}', {
489493
skipClick: true,
490494
});
491495

492-
await user.type(screen.getByText('1 Item'), '{enter}', {
496+
await user.type(screen.getByText('1 Item'), '{Enter}', {
493497
skipClick: true,
494498
});
495499

@@ -501,7 +505,7 @@ it('Closes the menu after pressing space on a menu item with a click handler', a
501505

502506
await user.tab();
503507

504-
await user.type(screen.getByText('Primary'), '{enter}', {
508+
await user.type(screen.getByText('Primary'), '{Enter}', {
505509
skipClick: true,
506510
});
507511

@@ -519,7 +523,7 @@ it('Activates the click handler of a menu item after pressing space while focuse
519523

520524
await user.tab();
521525

522-
await user.type(screen.getByText('Primary'), '{enter}', {
526+
await user.type(screen.getByText('Primary'), '{Enter}', {
523527
skipClick: true,
524528
});
525529

@@ -535,7 +539,7 @@ it('Moves the focus to the menu item with a label that starts with the correspon
535539

536540
await user.tab();
537541

538-
await user.type(screen.getByText('Primary'), '{enter}', {
542+
await user.type(screen.getByText('Primary'), '{Enter}', {
539543
skipClick: true,
540544
});
541545

@@ -551,7 +555,7 @@ it('Moves the focus to the provided menu item when `moveFocus` is called', async
551555

552556
await user.tab();
553557

554-
await user.type(screen.getByText('Primary'), '{enter}', {
558+
await user.type(screen.getByText('Primary'), '{Enter}', {
555559
skipClick: true,
556560
});
557561

0 commit comments

Comments
 (0)