Add tests for chart instance destroying

This commit is contained in:
Jakub Juszczak
2016-12-20 20:03:17 +01:00
parent 52c1c50206
commit 988d8f13b4
7 changed files with 145 additions and 0 deletions

View File

@@ -40,4 +40,25 @@ describe('BubbleChart', () => {
expect(vm.$el.querySelector('#bubblechartprop')).not.to.be.an('undefined')
})
it('should destroy chart instance', (done) => {
const vm = new Vue({
render: function (createElement) {
return createElement(
BubbleChart
)
},
components: { BubbleChart }
}).$mount(el)
expect(vm.$children[0]._chart.chart.ctx).not.to.be.null
vm.$destroy()
vm.$nextTick(() => {
vm.$forceUpdate()
expect(vm.$children[0]._chart.chart.ctx).to.be.null
done()
})
})
})