Skip to content

Commit

Permalink
⚡ improvement(mixin): release i18n instance
Browse files Browse the repository at this point in the history
  • Loading branch information
kazupon committed Feb 24, 2017
1 parent 8187eca commit cc362a3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,9 @@ export default {
// root i18n
this.$i18n = this.$root.$i18n
}
},

beforeDestroy () {
this.$i18n = null
}
}
3 changes: 3 additions & 0 deletions test/unit/component.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ describe('component translation', () => {
assert.equal(child1Fallback.textContent, 'fallback')
assert.equal(child2.textContent, 'root')
assert.equal(subChild1.textContent, 'root')
vm.$destroy()
}).then(() => {
assert(vm.$i18n === null)
}).then(done)
})
})

0 comments on commit cc362a3

Please sign in to comment.