-
-
Notifications
You must be signed in to change notification settings - Fork 838
/
Copy pathPie.spec.js
43 lines (37 loc) · 1.04 KB
/
Pie.spec.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import Vue from 'vue'
import PieChart from 'src/examples/PieExample'
describe('PieChart', () => {
let el
beforeEach(() => {
el = document.createElement('div')
})
it('should render a canvas', () => {
const vm = new Vue({
render: function (createElement) {
return createElement(
PieChart
)
},
components: { PieChart }
}).$mount(el)
expect(vm.$el.querySelector('#pie-chart')).not.to.be.an('undefined')
expect(vm.$el.querySelector('canvas')).not.to.be.an('undefined')
expect(vm.$el.querySelector('canvas')).not.to.be.an('null')
expect(vm.$el.querySelector('canvas')).to.exist
})
it('should change id based on prop', () => {
const vm = new Vue({
render: function (createElement) {
return createElement(
PieChart, {
props: {
chartId: 'piechartprop'
}
}
)
},
components: { PieChart }
}).$mount(el)
expect(vm.$el.querySelector('#piechartprop')).not.to.be.an('undefined')
})
})