File tree 2 files changed +10
-8
lines changed
2 files changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -223,7 +223,12 @@ var Search = {
223
223
$ ( "#show-results-label" ) . text ( "No matching pages found." ) ;
224
224
return ;
225
225
}
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
+
227
232
const loadButton = $ ( "#load-more-results" ) ;
228
233
loadButton . text ( `Loading ${
229
234
results . results . length < 2
@@ -300,11 +305,6 @@ var Search = {
300
305
selectResultOption : function ( ) {
301
306
var link = $ ( '#search-results a' ) [ Search . selectedIndex ] ;
302
307
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
- }
308
308
window . location . href = url ;
309
309
selectedIndex = 0 ;
310
310
} ,
Original file line number Diff line number Diff line change @@ -115,7 +115,8 @@ test('search', async ({ page }) => {
115
115
// Expect the first search result to be "git-commit"
116
116
const searchResults = page . locator ( '#search-results' )
117
117
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' )
119
120
120
121
// Expect the search page to show up
121
122
await searchBox . press ( 'Enter' )
@@ -137,7 +138,8 @@ test('search', async ({ page }) => {
137
138
await page . goto ( `${ url } docs/git-commit/fr` )
138
139
await searchBox . fill ( 'add' )
139
140
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 ) ? $ / )
141
143
142
144
// pressing the Enter key should navigate to the full search results page
143
145
await searchBox . press ( 'Enter' )
You can’t perform that action at this time.
0 commit comments