File tree Expand file tree Collapse file tree 1 file changed +22
-1
lines changed
packages/vue-i18n-core/test Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -64,14 +64,35 @@ describe('locale', () => {
6464 test ( 'reactivity' , async ( ) => {
6565 const fn = vi . fn ( )
6666
67- const { locale } = createComposer ( { } )
67+ const { locale, t } = createComposer ( {
68+ messages : {
69+ en : {
70+ test : 'en'
71+ } ,
72+ 'en-US' : {
73+ test : 'en-US'
74+ }
75+ }
76+ } )
6877 watch ( locale , fn )
6978 locale . value = 'en'
7079 await nextTick ( )
7180
7281 expect ( fn ) . toBeCalled ( )
7382 expect ( fn . mock . calls [ 0 ] [ 0 ] ) . toEqual ( 'en' )
7483 expect ( fn . mock . calls [ 0 ] [ 1 ] ) . toEqual ( 'en-US' )
84+
85+ let result = ''
86+ locale . value = 'en'
87+
88+ watch ( locale , ( ) => ( result = t ( 'test' ) ) , {
89+ immediate : true ,
90+ flush : 'sync'
91+ } )
92+ expect ( result ) . toEqual ( 'en' )
93+ locale . value = 'en-US'
94+ await nextTick ( )
95+ expect ( result ) . toEqual ( 'en-US' )
7596 } )
7697} )
7798
You can’t perform that action at this time.
0 commit comments