Skip to content

Commit

Permalink
💚 test(interporlation): add tests for literal {} on linked messages
Browse files Browse the repository at this point in the history
  • Loading branch information
kimuraz committed Dec 22, 2018
1 parent 368332d commit e3c11c0
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions test/unit/interpolation.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const messages = {
primitive: 'one: {0}, two: {1}',
component: 'element: {0}, component: {1}',
mixed: 'text: {x}, component: {y}',
linkedMixed: '@:mixed',
link: '@:primitive',
term: 'I accept xxx {0}.',
tos: 'Term of service',
Expand Down Expand Up @@ -191,6 +192,24 @@ describe('component interpolation', () => {
})
})

describe('does not place on linked literal {}', () => {
it('should be interpolated', done => {
const el = document.createElement('div')
const vm = new Vue({
i18n,
components,
render (h) {
return h('i18n', { props: { path: 'linkedMixed', places: { 'x': 'foo {text}', 'text': 'raw' } } }, [
h('comp', { props: { msg: 'bar' }, attrs: { place: 'y' } })
])
}
}).$mount(el)
nextTick(() => {
assert.strictEqual(vm.$el.innerHTML, 'text: foo, component: <p place="y">bar</p>')
}).then(done)
})
})

describe('fallback', () => {
it('should be interpolated', done => {
const el = document.createElement('div')
Expand Down

0 comments on commit e3c11c0

Please sign in to comment.