Skip to content

Commit e77e63c

Browse files
committed
:white_heavy_check_mark: test: add more test
1 parent 6967a15 commit e77e63c

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

test/unit/custom_blocks.test.js

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,4 +70,41 @@ describe('custom blocks', () => {
7070
}).then(done)
7171
})
7272
})
73+
74+
describe('sharedMessages option', () => {
75+
it('should be translated', done => {
76+
const el = document.createElement('div')
77+
const vm = new Vue({
78+
i18n,
79+
components: {
80+
child: {
81+
__i18n: [JSON.stringify({
82+
en: { who: 'child' },
83+
ja: { who: '子' }
84+
})],
85+
i18n: {
86+
sharedMessages: {
87+
en: { foo: 'foo' },
88+
ja: { foo: 'フー' }
89+
}
90+
},
91+
render (h) {
92+
return h('div', {}, [
93+
h('p', { ref: 'foo' }, [this.$t('foo')])
94+
])
95+
}
96+
}
97+
},
98+
render (h) {
99+
return h('div', {}, [h('child', { ref: 'child' })])
100+
}
101+
}).$mount(el)
102+
nextTick(() => {
103+
assert.strictEqual(vm.$refs.child.$refs.foo.textContent, 'フー')
104+
i18n.locale = 'en'
105+
}).then(() => {
106+
assert.strictEqual(vm.$refs.child.$refs.foo.textContent, 'foo')
107+
}).then(done)
108+
})
109+
})
73110
})

0 commit comments

Comments
 (0)