Skip to content

Commit ef77c0d

Browse files
authored
Merge pull request #140 from apertureless/feature/update_tests
✅ Update tests for addPlugin method
2 parents a996049 + 4109fb3 commit ef77c0d

File tree

9 files changed

+181
-1
lines changed

9 files changed

+181
-1
lines changed

test/unit/specs/Bar.spec.js

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,28 @@ describe('BarChart', () => {
5757

5858
vm.$nextTick(() => {
5959
vm.$forceUpdate()
60-
expect(vm.$children[0]._chart.chart.ctx).to.be.null
60+
expect(vm.$children[0]._chart.chart.ctx).to.equal
6161
done()
6262
})
6363
})
64+
65+
it('should add an inline plugin to the array', () => {
66+
const testPlugin = {
67+
id: 'test'
68+
}
69+
70+
const vm = new Vue({
71+
render: function (createElement) {
72+
return createElement(
73+
BarChart
74+
)
75+
},
76+
components: { BarChart }
77+
}).$mount(el)
78+
79+
expect(vm.$children[0].plugins).to.exist
80+
vm.$children[0].addPlugin(testPlugin)
81+
82+
expect(vm.$children[0].plugins.length).to.equal(1)
83+
})
6484
})

test/unit/specs/Bubble.spec.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,24 @@ describe('BubbleChart', () => {
6161
done()
6262
})
6363
})
64+
65+
it('should add an inline plugin to the array', () => {
66+
const testPlugin = {
67+
id: 'test'
68+
}
69+
70+
const vm = new Vue({
71+
render: function (createElement) {
72+
return createElement(
73+
BubbleChart
74+
)
75+
},
76+
components: { BubbleChart }
77+
}).$mount(el)
78+
79+
expect(vm.$children[0].plugins).to.exist
80+
vm.$children[0].addPlugin(testPlugin)
81+
82+
expect(vm.$children[0].plugins.length).to.equal(1)
83+
})
6484
})

test/unit/specs/Doughnut.spec.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,24 @@ describe('DoughnutChart', () => {
6161
done()
6262
})
6363
})
64+
65+
it('should add an inline plugin to the array', () => {
66+
const testPlugin = {
67+
id: 'test'
68+
}
69+
70+
const vm = new Vue({
71+
render: function (createElement) {
72+
return createElement(
73+
DoughnutChart
74+
)
75+
},
76+
components: { DoughnutChart }
77+
}).$mount(el)
78+
79+
expect(vm.$children[0].plugins).to.exist
80+
vm.$children[0].addPlugin(testPlugin)
81+
82+
expect(vm.$children[0].plugins.length).to.equal(1)
83+
})
6484
})

test/unit/specs/HorizontalBar.spec.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,24 @@ describe('HorizontalBarChart', () => {
6161
done()
6262
})
6363
})
64+
65+
it('should add an inline plugin to the array', () => {
66+
const testPlugin = {
67+
id: 'test'
68+
}
69+
70+
const vm = new Vue({
71+
render: function (createElement) {
72+
return createElement(
73+
HorizontalBarChart
74+
)
75+
},
76+
components: { HorizontalBarChart }
77+
}).$mount(el)
78+
79+
expect(vm.$children[0].plugins).to.exist
80+
vm.$children[0].addPlugin(testPlugin)
81+
82+
expect(vm.$children[0].plugins.length).to.equal(1)
83+
})
6484
})

test/unit/specs/Line.spec.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,24 @@ describe('LineChart', () => {
6161
done()
6262
})
6363
})
64+
65+
it('should add an inline plugin to the array', () => {
66+
const testPlugin = {
67+
id: 'test'
68+
}
69+
70+
const vm = new Vue({
71+
render: function (createElement) {
72+
return createElement(
73+
LineChart
74+
)
75+
},
76+
components: { LineChart }
77+
}).$mount(el)
78+
79+
expect(vm.$children[0].plugins).to.exist
80+
vm.$children[0].addPlugin(testPlugin)
81+
82+
expect(vm.$children[0].plugins.length).to.equal(1)
83+
})
6484
})

test/unit/specs/Pie.spec.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,24 @@ describe('PieChart', () => {
6060
done()
6161
})
6262
})
63+
64+
it('should add an inline plugin to the array', () => {
65+
const testPlugin = {
66+
id: 'test'
67+
}
68+
69+
const vm = new Vue({
70+
render: function (createElement) {
71+
return createElement(
72+
PieChart
73+
)
74+
},
75+
components: { PieChart }
76+
}).$mount(el)
77+
78+
expect(vm.$children[0].plugins).to.exist
79+
vm.$children[0].addPlugin(testPlugin)
80+
81+
expect(vm.$children[0].plugins.length).to.equal(1)
82+
})
6383
})

test/unit/specs/PolarArea.spec.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,24 @@ describe('PolarChart', () => {
6161
done()
6262
})
6363
})
64+
65+
it('should add an inline plugin to the array', () => {
66+
const testPlugin = {
67+
id: 'test'
68+
}
69+
70+
const vm = new Vue({
71+
render: function (createElement) {
72+
return createElement(
73+
PolarChart
74+
)
75+
},
76+
components: { PolarChart }
77+
}).$mount(el)
78+
79+
expect(vm.$children[0].plugins).to.exist
80+
vm.$children[0].addPlugin(testPlugin)
81+
82+
expect(vm.$children[0].plugins.length).to.equal(1)
83+
})
6484
})

test/unit/specs/Radar.spec.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,24 @@ describe('RadarChart', () => {
6060
done()
6161
})
6262
})
63+
64+
it('should add an inline plugin to the array', () => {
65+
const testPlugin = {
66+
id: 'test'
67+
}
68+
69+
const vm = new Vue({
70+
render: function (createElement) {
71+
return createElement(
72+
RadarChart
73+
)
74+
},
75+
components: { RadarChart }
76+
}).$mount(el)
77+
78+
expect(vm.$children[0].plugins).to.exist
79+
vm.$children[0].addPlugin(testPlugin)
80+
81+
expect(vm.$children[0].plugins.length).to.equal(1)
82+
})
6383
})

test/unit/specs/Scatter.spec.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,24 @@ describe('ScatterChart', () => {
6161
done()
6262
})
6363
})
64+
65+
it('should add an inline plugin to the array', () => {
66+
const testPlugin = {
67+
id: 'test'
68+
}
69+
70+
const vm = new Vue({
71+
render: function (createElement) {
72+
return createElement(
73+
ScatterChart
74+
)
75+
},
76+
components: { ScatterChart }
77+
}).$mount(el)
78+
79+
expect(vm.$children[0].plugins).to.exist
80+
vm.$children[0].addPlugin(testPlugin)
81+
82+
expect(vm.$children[0].plugins.length).to.equal(1)
83+
})
6484
})

0 commit comments

Comments
 (0)