@@ -103,6 +103,9 @@ describe('localePath', () => {
103103 assert . equal ( vm . localePath ( { path : '/' , query : { foo : 1 } } ) , '/ja?foo=1' )
104104 assert . equal ( vm . localePath ( { name : 'about' , query : { foo : 1 } } ) , '/ja/about?foo=1' )
105105 assert . equal ( vm . localePath ( { path : '/about' , query : { foo : 1 } } ) , '/ja/about?foo=1' )
106+ assert . equal ( vm . localePath ( '/?foo=1' ) , '/ja?foo=1' )
107+ assert . equal ( vm . localePath ( '/about?foo=1' ) , '/ja/about?foo=1' )
108+ assert . equal ( vm . localePath ( '/about?foo=1&test=2' ) , '/ja/about?foo=1&test=2' )
106109
107110 // no define path
108111 assert . equal ( vm . localePath ( '/vue-i18n' ) , '/ja/vue-i18n' )
@@ -420,6 +423,11 @@ describe('switchLocalePath', () => {
420423 assert . equal ( vm . switchLocalePath ( 'fr' ) , '/fr/about' )
421424 assert . equal ( vm . switchLocalePath ( 'vue-i18n' ) , '' )
422425
426+ await router . push ( '/ja/about?foo=1&test=2' )
427+ assert . equal ( vm . switchLocalePath ( 'ja' ) , '/ja/about?foo=1&test=2' )
428+ assert . equal ( vm . switchLocalePath ( 'fr' ) , '/fr/about?foo=1&test=2' )
429+ assert . equal ( vm . switchLocalePath ( 'en' ) , '/en/about?foo=1&test=2' )
430+
423431 await router . push ( '/ja/category/1' )
424432 assert . equal ( vm . switchLocalePath ( 'ja' ) , '/ja/category/japanese' )
425433 assert . equal ( vm . switchLocalePath ( 'en' ) , '/en/category/english' )
0 commit comments