Skip to content

Commit 2f5f3fa

Browse files
author
Raphael Jackstadt
committed
feat: add tests for language arrays support
1 parent 7ce9f43 commit 2f5f3fa

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

test/fixtures/lang/de.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"auth.arr.0": "foo",
3+
"auth.arr.1": "bar"
4+
}

test/translate.test.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,3 +173,17 @@ it('resolves translated data with loader if there is only .php files for that la
173173

174174
expect(wrapper.html()).toBe('<h1>Ces identifiants ne correspondent pas à nos enregistrements.</h1>')
175175
})
176+
177+
178+
it('translates arrays with $t mixin', async () => {
179+
const wrapper = await global.mountPlugin(`<h1 v-for="line in $t('auth.arr')">{{line}}</h1>`, 'de');
180+
181+
expect(wrapper.html()).toBe("<h1>foo</h1>\n<h1>bar</h1>")
182+
})
183+
184+
it('translates arrays with "trans" helper', async () => {
185+
await global.mountPlugin(undefined, 'de');
186+
187+
expect(trans('auth.arr')).toStrictEqual(['foo', 'bar']);
188+
})
189+

0 commit comments

Comments
 (0)