@@ -1235,7 +1235,7 @@ test("⌘W closes the session tab again once the window loses focus after the si
12351235 await expect ( sessions . alphaTab ) . toHaveCount ( 0 )
12361236} )
12371237
1238- test ( "⌘W in the side panel closes its New tab, then the panel, and only then the session tab" , async ( { page } ) => {
1238+ test ( "⌘W in the side panel closes its last New tab with the panel, and only then the session tab" , async ( { page } ) => {
12391239 await page . setViewportSize ( { width : 1440 , height : 900 } )
12401240 const alpha = { id : "ses_side_new_alpha" , title : "Side new alpha" }
12411241 const beta = { id : "ses_side_new_beta" , title : "Side new beta" }
@@ -1254,14 +1254,14 @@ test("⌘W in the side panel closes its New tab, then the panel, and only then t
12541254 // A launcher row in the New tab view holds focus as ⌘W removes it.
12551255 await panel . getByRole ( "button" , { name : / ^ O p e n f i l e / } ) . focus ( )
12561256
1257+ // The New tab was the panel's last tab, so closing it closes the panel too, and focus goes back.
12571258 await page . keyboard . press ( "ControlOrMeta+w" )
12581259 await expect ( newTab ) . toHaveCount ( 0 )
1259- await expect ( toggle ) . toHaveAttribute ( "aria-expanded" , "true" )
1260-
1261- // Nothing is left to close in the panel, so ⌘W closes the panel rather than the session, and focus goes back.
1262- await page . keyboard . press ( "ControlOrMeta+w" )
12631260 await expect ( toggle ) . toHaveAttribute ( "aria-expanded" , "false" )
12641261 await expect ( composer ) . toBeFocused ( )
1262+
1263+ // One press too many closes nothing rather than the session.
1264+ await page . keyboard . press ( "ControlOrMeta+w" )
12651265 await expect ( alphaTab ) . toHaveCount ( 1 )
12661266 await expectPath ( page , sessionHref ( alpha . id ) )
12671267
0 commit comments