File tree Expand file tree Collapse file tree 2 files changed +10
-8
lines changed
Expand file tree Collapse file tree 2 files changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -223,7 +223,12 @@ var Search = {
223223 $ ( "#show-results-label" ) . text ( "No matching pages found." ) ;
224224 return ;
225225 }
226- $ ( "#show-results-label" ) . text ( "Show all results..." ) ;
226+
227+ const language = document . querySelector ( "html" ) ?. getAttribute ( "lang" ) ;
228+ $ ( "#show-results-label" )
229+ . text ( "Show all results..." )
230+ . attr ( 'href' , `${ baseURLPrefix } search/results?search=${ term } ${ language && `&language=${ language } ` } ` ) ;
231+
227232 const loadButton = $ ( "#load-more-results" ) ;
228233 loadButton . text ( `Loading ${
229234 results . results . length < 2
@@ -300,11 +305,6 @@ var Search = {
300305 selectResultOption : function ( ) {
301306 var link = $ ( '#search-results a' ) [ Search . selectedIndex ] ;
302307 var url = $ ( link ) . attr ( 'href' ) ;
303- if ( ! url ) {
304- const term = $ ( '#search-text' ) . val ( ) ;
305- const language = document . querySelector ( "html" ) ?. getAttribute ( "lang" ) ;
306- url = `${ baseURLPrefix } search/results?search=${ term } ${ language && `&language=${ language } ` } ` ;
307- }
308308 window . location . href = url ;
309309 selectedIndex = 0 ;
310310 } ,
Original file line number Diff line number Diff line change @@ -115,7 +115,8 @@ test('search', async ({ page }) => {
115115 // Expect the first search result to be "git-commit"
116116 const searchResults = page . locator ( '#search-results' )
117117 await expect ( searchResults . getByRole ( "link" ) ) . not . toHaveCount ( 0 )
118- await expect ( searchResults . getByRole ( "link" ) . nth ( 0 ) ) . toHaveText ( 'git-commit' )
118+ await expect ( searchResults . getByRole ( "link" ) . nth ( 0 ) ) . toHaveText ( 'Show all results...' )
119+ await expect ( searchResults . getByRole ( "link" ) . nth ( 1 ) ) . toHaveText ( 'git-commit' )
119120
120121 // Expect the search page to show up
121122 await searchBox . press ( 'Enter' )
@@ -137,7 +138,8 @@ test('search', async ({ page }) => {
137138 await page . goto ( `${ url } docs/git-commit/fr` )
138139 await searchBox . fill ( 'add' )
139140 await searchBox . press ( 'Shift' )
140- await expect ( searchResults . getByRole ( "link" ) . nth ( 0 ) ) . toHaveAttribute ( 'href' , / \/ d o c s \/ g i t - a d d \/ f r ( \. h t m l ) ? $ / )
141+ await expect ( searchResults . getByRole ( "link" ) . nth ( 0 ) ) . toHaveAttribute ( 'href' , / \/ s e a r c h \/ r e s u l t s \? s e a r c h = a d d & l a n g u a g e = f r $ / )
142+ await expect ( searchResults . getByRole ( "link" ) . nth ( 1 ) ) . toHaveAttribute ( 'href' , / \/ d o c s \/ g i t - a d d \/ f r ( \. h t m l ) ? $ / )
141143
142144 // pressing the Enter key should navigate to the full search results page
143145 await searchBox . press ( 'Enter' )
You can’t perform that action at this time.
0 commit comments