File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -143,6 +143,9 @@ const vocabSearch = Vue.createApp({
143
143
if ( 'uri' in result ) { // create relative Skosmos page URL from the search result URI
144
144
result . pageUrl = window . SKOSMOS . vocab + '/' + window . SKOSMOS . lang + '/page?'
145
145
const urlParams = new URLSearchParams ( { uri : result . uri } )
146
+ if ( this . selectedLanguage !== window . SKOSMOS . lang ) { // add content language parameter
147
+ urlParams . append ( 'clang' , this . selectedLanguage )
148
+ }
146
149
result . pageUrl += urlParams . toString ( )
147
150
}
148
151
// render search result renderedTypes
Original file line number Diff line number Diff line change @@ -156,6 +156,24 @@ describe('Vocab search bar', () => {
156
156
cy . get ( '#main-container' ) . click ( { force : true } ) ; // using force true to click on elements not considered actionable
157
157
cy . get ( '#search-autocomplete-results' ) . should ( 'not.be.visible' ) ; // the autocomplete should disappear
158
158
} )
159
+ it ( 'Search language parameter is passed to the autocomplete result links' , ( ) => {
160
+ cy . visit ( '/yso/sv/' )
161
+
162
+ // Choose 'fi' for search & content language
163
+ cy . get ( '#language-selector .dropdown-toggle' ) . click ( ) ;
164
+ cy . get ( '#language-list .dropdown-item' ) . contains ( 'finska' ) . click ( ) ;
165
+
166
+ // Searchg for 'kissa'
167
+ cy . get ( '#search-field' ) . type ( 'aarre' ) ;
168
+ cy . get ( '#search-autocomplete-results' , { timeout : 20000 } ) . should ( 'be.visible' ) ; // the autocomplete should appear
169
+
170
+ // Click the first search result
171
+ cy . get ( '#search-autocomplete-results li:first-child a' ) . click ( ) ;
172
+
173
+ // The language parameters should persist on the concept page
174
+ cy . url ( ) . should ( 'include' , '/sv/' ) ;
175
+ cy . url ( ) . should ( 'include' , 'clang=fi' ) ;
176
+ } )
159
177
} ) ;
160
178
161
179
describe ( 'Search Result Rendering' , ( ) => {
You can’t perform that action at this time.
0 commit comments