Skip to content

Commit 6c8fced

Browse files
committed
feat(tests): add checking with watchEffect
1 parent 9b52235 commit 6c8fced

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

packages/vue-i18n-core/test/legacy.test.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,22 @@ describe('availableLocales', () => {
6666
i18n.setLocaleMessage('ru', { hello: 'Привет мир!' })
6767
expect(i18n.availableLocales).toEqual(['en', 'ja', 'fr', 'ru'].sort())
6868
})
69+
test('trigger new value with watchEffect', async () => {
70+
const i18n = createVueI18n({
71+
messages: {
72+
ja: {}
73+
}
74+
})
75+
let locales = [] as string[]
76+
77+
watchEffect(() => {
78+
locales = i18n.availableLocales
79+
})
80+
81+
i18n.setLocaleMessage('en', { hello: 'Hello' })
82+
await nextTick()
83+
expect(locales.sort()).toEqual(['en', 'ja'].sort())
84+
})
6985
})
7086

7187
test('missing', () => {

0 commit comments

Comments
 (0)