Skip to content

Commit 94b7b03

Browse files
committed
✅ test: add missing case
1 parent 578839c commit 94b7b03

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

test/module.test.js

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,11 @@ const options = {
1212
messages: {
1313
en: {
1414
hello: 'hello',
15-
named: 'hi {name}!',
16-
list: 'hi {0}!'
15+
named: 'hi {name}!'
1716
},
1817
ja: {
1918
hello: 'こんにちは',
20-
named: 'やあ、{name}!',
21-
list: 'やあ、{0}!'
19+
named: 'やあ、{name}!'
2220
}
2321
}
2422
}
@@ -59,3 +57,15 @@ test('not support value warning', t => {
5957
t.truthy(spy.withArgs('[vue-i18n-extensions] not support value type').calledOnce)
6058
spy.restore()
6159
})
60+
61+
test('detect missing translation', t => {
62+
i18n.missing = (locale, key, vm) => {
63+
t.is(locale, 'en')
64+
t.is(key, 'foo.bar')
65+
t.is(vm, null)
66+
}
67+
const { ast, render, errors } = compile(`<p v-t="'foo.bar'"></p>`, { modules: [i18nModule] })
68+
t.is(ast.i18n, 'foo.bar')
69+
t.is(render, `with(this){return _c(\'p\',{domProps:{"textContent":_s("foo.bar")}})}`)
70+
t.deepEqual(errors, [])
71+
})

0 commit comments

Comments
 (0)