@@ -135,6 +135,19 @@ async function zoomInUntilMapPinsAreDetailed(page: Page) {
135135 await expectMapPinDetailScale ( page , 1 ) ;
136136}
137137
138+ async function focusMapControlByKeyboard ( page : Page , testId : string ) {
139+ for ( let i = 0 ; i < 20 ; i += 1 ) {
140+ await page . keyboard . press ( "Tab" ) ;
141+ const activeTestId = await page . evaluate ( ( ) =>
142+ document . activeElement ?. getAttribute ( "data-testid" )
143+ ) ;
144+
145+ if ( activeTestId === testId ) return ;
146+ }
147+
148+ throw new Error ( `Could not focus ${ testId } by keyboard` ) ;
149+ }
150+
138151test ( "map mounts when IP location is unavailable and restores the last view" , async ( {
139152 page,
140153} ) => {
@@ -155,6 +168,16 @@ test("map mounts when IP location is unavailable and restores the last view", as
155168 } ) ;
156169 expect ( await readStoredMapView ( page ) ) . toBeNull ( ) ;
157170
171+ await focusMapControlByKeyboard ( page , "map-control-search" ) ;
172+ await expect ( page . getByTestId ( "map-control-search" ) ) . toBeFocused ( ) ;
173+ await expect
174+ . poll ( ( ) =>
175+ page
176+ . getByTestId ( "map-control-search" )
177+ . evaluate ( ( element ) => getComputedStyle ( element ) . boxShadow )
178+ )
179+ . toContain ( "inset" ) ;
180+
158181 await page . getByTestId ( "map-control-zoom-in" ) . click ( ) ;
159182
160183 await expect
@@ -264,6 +287,16 @@ test("map search palette flies to a picked geocoding result", async ({
264287 await page . getByTestId ( "map-control-search" ) . click ( ) ;
265288 const searchInput = page . getByTestId ( "geocoding-search-input" ) ;
266289 await expect ( searchInput ) . toBeFocused ( ) ;
290+ await expect (
291+ page . getByTestId ( "map-search-dialog" ) . getByRole ( "button" , {
292+ name : "Close" ,
293+ } )
294+ ) . toHaveCount ( 0 ) ;
295+ await page . keyboard . press ( "Escape" ) ;
296+ await expect ( page . getByTestId ( "map-search-dialog" ) ) . toBeHidden ( ) ;
297+
298+ await page . getByTestId ( "map-control-search" ) . click ( ) ;
299+ await expect ( searchInput ) . toBeFocused ( ) ;
267300 await searchInput . fill ( "Newtown" ) ;
268301 await expect
269302 . poll ( async ( ) =>
0 commit comments