-
| I am trying to test a component where the localization data is in the I did it something like this const i18n = createI18n({ locale: 'en', messages, globalInjection: true }) it('should display age correctly in English', () => { i18n.global.locale = 'en' const wrapper = mount(LjAge, { global: { plugins: [i18n], }, props: { birthDate: '2014-11-11', today: '2024-07-29', }, }) expect(wrapper.text()).toBe('9y 8m') }) it('should display age correctly in Spanish', () => { i18n.global.locale = 'es' const wrapper = mount(LjAge, { global: { plugins: [i18n], }, props: { birthDate: '2014-11-11', today: '2024-07-29', }, }) expect(wrapper.text()).toBe('9a 8m') }) |
Beta Was this translation helpful? Give feedback.
Answered by trajano Aug 19, 2024
Replies: 1 comment
-
| I inlined it so this works it('should work with mounted component in Spanish', () => { const wrapper = mount(LjAge, { global: { plugins: [ createI18n({ locale: 'es' }) ] }, props: { birthDate: '2014-11-11', today: '2024-07-29' } }) expect(wrapper.text()).toBe('9a 8m') }) |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by trajano
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
I inlined it so this works