@@ -61,21 +61,30 @@ test('the new-task draft follows the Project chosen under the composer', async (
6161 // different path and was never broken.
6262 await expect ( picker ) . toHaveAttribute ( 'aria-label' , new RegExp ( NEW_TASK_PROJECT_NAME ) ) ;
6363
64- await composer . click ( ) ;
65- await page . keyboard . type ( DRAFT ) ;
64+ await composer . fill ( DRAFT ) ;
6665 await expect ( composer ) . toHaveText ( DRAFT ) ;
6766
68- await picker . click ( ) ;
69- await page . getByRole ( 'menuitem' , { name : '无项目' , exact : true } ) . click ( ) ;
70- // The picker's label is the selected target, so this asserts the click moved
71- // the selection. Without it the draft assertion below would still pass if the
72- // menu item stopped selecting anything at all.
67+ await picker . press ( 'Enter' ) ;
68+ const projectItem = page . getByRole ( 'menuitem' , { name : NEW_TASK_PROJECT_NAME , exact : true } ) ;
69+ const noProjectItem = page . getByRole ( 'menuitem' , { name : '无项目' , exact : true } ) ;
70+ await expect ( projectItem ) . toBeFocused ( ) ;
71+ await page . keyboard . press ( 'End' ) ;
72+ await expect ( noProjectItem ) . toBeFocused ( ) ;
73+ await page . keyboard . press ( 'Enter' ) ;
74+ await expect ( noProjectItem ) . toHaveCount ( 0 ) ;
75+ // The picker's label is the selected target, so this asserts the menu action
76+ // moved the selection. Without it the draft assertion below would still pass
77+ // if the menu item stopped selecting anything at all.
7378 await expect ( picker ) . toHaveAttribute ( 'aria-label' , / 无 项 目 / ) ;
7479 await settle ( page ) ;
7580 await expect ( composer ) . toHaveText ( DRAFT ) ;
7681
77- await picker . click ( ) ;
78- await page . getByRole ( 'menuitem' , { name : NEW_TASK_PROJECT_NAME , exact : true } ) . click ( ) ;
82+ // Keyboard activation follows the menu button's public interaction contract
83+ // and is not suppressed by the pointer light-dismiss guard while the first
84+ // selection's replacement picker settles.
85+ await picker . press ( 'Enter' ) ;
86+ await expect ( projectItem ) . toBeFocused ( ) ;
87+ await page . keyboard . press ( 'Enter' ) ;
7988 await expect ( picker ) . toHaveAttribute ( 'aria-label' , new RegExp ( NEW_TASK_PROJECT_NAME ) ) ;
8089 await settle ( page ) ;
8190 await expect ( composer ) . toHaveText ( DRAFT ) ;
0 commit comments