-
-
Notifications
You must be signed in to change notification settings - Fork 838
/
Copy pathBar.spec.js
43 lines (37 loc) · 1.04 KB
/
Bar.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 BarChart from 'src/examples/BarExample'
describe('BarChart', () => {
let el
beforeEach(() => {
el = document.createElement('div')
})
it('should render a canvas', () => {
const vm = new Vue({
render: function (createElement) {
return createElement(
BarChart
)
},
components: { BarChart }
}).$mount(el)
expect(vm.$el.querySelector('#bar-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(
BarChart, {
props: {
chartId: 'barchartprop'
}
}
)
},
components: { BarChart }
}).$mount(el)
expect(vm.$el.querySelector('#barchartprop')).not.to.be.an('undefined')
})
})