@@ -331,7 +331,7 @@ test.describe('Keyboard Behavior', () => {
331
331
} ) ;
332
332
333
333
test . describe ( 'selecting options' , ( ) => {
334
- test ( `GIVEN an opened hero select with the first option highlighted
334
+ test ( `GIVEN an opened select with the first option highlighted
335
335
WHEN the Enter key is pressed
336
336
THEN the listbox should be closed and aria-expanded should be false` , async ( {
337
337
page,
@@ -346,7 +346,7 @@ test.describe('Keyboard Behavior', () => {
346
346
await expect ( d . getTrigger ( ) ) . toHaveAttribute ( 'aria-expanded' , 'false' ) ;
347
347
} ) ;
348
348
349
- test ( `GIVEN an open hero select
349
+ test ( `GIVEN an open select
350
350
WHEN an option has data-highlighted
351
351
AND the Enter key is pressed
352
352
THEN option value should be the selected value
@@ -361,7 +361,7 @@ test.describe('Keyboard Behavior', () => {
361
361
await expect ( d . getValueElement ( ) ) . toHaveText ( expectedValue ! ) ;
362
362
} ) ;
363
363
364
- test ( `GIVEN an open hero select
364
+ test ( `GIVEN an open select
365
365
WHEN an option has data-highlighted
366
366
AND the Space key is pressed
367
367
THEN the listbox should be closed and aria-expanded false` , async ( {
@@ -393,6 +393,17 @@ test.describe('Keyboard Behavior', () => {
393
393
await expect ( d . getValueElement ( ) ) . toHaveText ( expectedValue ! ) ;
394
394
} ) ;
395
395
396
+ test ( `GIVEN an open select
397
+ WHEN an option is selected
398
+ THEN focus should go back to the trigger` , async ( { page } ) => {
399
+ const { driver : d } = await setup ( page , 'hero' ) ;
400
+
401
+ await d . openListbox ( 'Space' ) ;
402
+
403
+ await d . getHighlightedItem ( ) . press ( 'Enter' ) ;
404
+ await expect ( d . getTrigger ( ) ) . toBeFocused ( ) ;
405
+ } ) ;
406
+
396
407
test ( `GIVEN no selected item and a placeholder
397
408
WHEN pressing the right arrow key once
398
409
THEN the first enabled option should be selected and have aria-selected` , async ( {
0 commit comments