Skip to content

Commit 13ff782

Browse files
committed
🐛 Fix tests
Signed-off-by: Jakub Juszczak <[email protected]>
1 parent 975a804 commit 13ff782

File tree

7 files changed

+119
-21
lines changed

7 files changed

+119
-21
lines changed

test/unit/specs/Bar.spec.js

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,30 @@ import Vue from 'vue'
22
import BarChart from 'src/examples/BarExample'
33

44
describe('BarChart', () => {
5+
let el
6+
7+
beforeEach(() => {
8+
el = document.createElement('div')
9+
})
10+
511
it('should render a canvas', () => {
612
const vm = new Vue({
7-
el: 'body',
8-
replace: false,
913
template: '<bar-chart></bar-chart>',
1014
components: { BarChart }
11-
})
15+
}).$mount(el)
16+
1217
expect(vm.$el.querySelector('#bar-chart')).not.to.be.an('undefined')
1318
expect(vm.$el.querySelector('canvas')).not.to.be.an('undefined')
1419
expect(vm.$el.querySelector('canvas')).not.to.be.an('null')
1520
expect(vm.$el.querySelector('canvas')).to.exist
1621
})
22+
23+
it('should change id based on prop', () => {
24+
const vm = new Vue({
25+
template: '<bar-chart chartId="barchartprop"></bar-chart>',
26+
components: { BarChart }
27+
}).$mount(el)
28+
29+
expect(vm.$el.querySelector('#barchartprop')).not.to.be.an('undefined')
30+
})
1731
})

test/unit/specs/Bubble.spec.js

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,30 @@ import Vue from 'vue'
22
import BubbleChart from 'src/examples/BubbleExample'
33

44
describe('BubbleChart', () => {
5+
let el
6+
7+
beforeEach(() => {
8+
el = document.createElement('div')
9+
})
10+
511
it('should render a canvas', () => {
612
const vm = new Vue({
7-
el: 'body',
8-
replace: false,
913
template: '<bubble-chart></bubble-chart>',
1014
components: { BubbleChart }
11-
})
15+
}).$mount(el)
16+
1217
expect(vm.$el.querySelector('#bubble-chart')).not.to.be.an('undefined')
1318
expect(vm.$el.querySelector('canvas')).not.to.be.an('undefined')
1419
expect(vm.$el.querySelector('canvas')).not.to.be.an('null')
1520
expect(vm.$el.querySelector('canvas')).to.exist
1621
})
22+
23+
it('should change id based on prop', () => {
24+
const vm = new Vue({
25+
template: '<bubble-chart chartId="bubblechartprop"></bubble-chart>',
26+
components: { BubbleChart }
27+
}).$mount(el)
28+
29+
expect(vm.$el.querySelector('#bubblechartprop')).not.to.be.an('undefined')
30+
})
1731
})

test/unit/specs/Doughnut.spec.js

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,30 @@ import Vue from 'vue'
22
import DoughnutChart from 'src/examples/DoughnutExample'
33

44
describe('DoughnutChart', () => {
5+
let el
6+
7+
beforeEach(() => {
8+
el = document.createElement('div')
9+
})
10+
511
it('should render a canvas', () => {
612
const vm = new Vue({
7-
el: 'body',
8-
replace: false,
913
template: '<doughnut-chart></doughnut-chart>',
1014
components: { DoughnutChart }
11-
})
15+
}).$mount(el)
16+
1217
expect(vm.$el.querySelector('#doughnut-chart')).not.to.be.an('undefined')
1318
expect(vm.$el.querySelector('canvas')).not.to.be.an('undefined')
1419
expect(vm.$el.querySelector('canvas')).not.to.be.an('null')
1520
expect(vm.$el.querySelector('canvas')).to.exist
1621
})
22+
23+
it('should change id based on prop', () => {
24+
const vm = new Vue({
25+
template: '<doughnut-chart chartId="doughnutchartprop"></doughnut-chart>',
26+
components: { DoughnutChart }
27+
}).$mount(el)
28+
29+
expect(vm.$el.querySelector('#doughnutchartprop')).not.to.be.an('undefined')
30+
})
1731
})

test/unit/specs/Line.spec.js

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,30 @@ import Vue from 'vue'
22
import LineChart from 'src/examples/LineExample'
33

44
describe('LineChart', () => {
5+
let el
6+
7+
beforeEach(() => {
8+
el = document.createElement('div')
9+
})
10+
511
it('should render a canvas', () => {
612
const vm = new Vue({
7-
el: 'body',
8-
replace: false,
913
template: '<line-chart></line-chart>',
1014
components: { LineChart }
11-
})
15+
}).$mount(el)
16+
1217
expect(vm.$el.querySelector('#line-chart')).not.to.be.an('undefined')
1318
expect(vm.$el.querySelector('canvas')).not.to.be.an('undefined')
1419
expect(vm.$el.querySelector('canvas')).not.to.be.an('null')
1520
expect(vm.$el.querySelector('canvas')).to.exist
1621
})
22+
23+
it('should change id based on prop', () => {
24+
const vm = new Vue({
25+
template: '<line-chart chartId="linechartprop"></line-chart>',
26+
components: { LineChart }
27+
}).$mount(el)
28+
29+
expect(vm.$el.querySelector('#linechartprop')).not.to.be.an('undefined')
30+
})
1731
})

test/unit/specs/Pie.spec.js

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,30 @@ import Vue from 'vue'
22
import PieChart from 'src/examples/PieExample'
33

44
describe('PieChart', () => {
5+
let el
6+
7+
beforeEach(() => {
8+
el = document.createElement('div')
9+
})
10+
511
it('should render a canvas', () => {
612
const vm = new Vue({
7-
el: 'body',
8-
replace: false,
913
template: '<pie-chart></pie-chart>',
1014
components: { PieChart }
11-
})
15+
}).$mount(el)
16+
1217
expect(vm.$el.querySelector('#pie-chart')).not.to.be.an('undefined')
1318
expect(vm.$el.querySelector('canvas')).not.to.be.an('undefined')
1419
expect(vm.$el.querySelector('canvas')).not.to.be.an('null')
1520
expect(vm.$el.querySelector('canvas')).to.exist
1621
})
22+
23+
it('should change id based on prop', () => {
24+
const vm = new Vue({
25+
template: '<pie-chart chartId="piechartprop"></pie-chart>',
26+
components: { PieChart }
27+
}).$mount(el)
28+
29+
expect(vm.$el.querySelector('#piechartprop')).not.to.be.an('undefined')
30+
})
1731
})

test/unit/specs/PolarArea.spec.js

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,30 @@ import Vue from 'vue'
22
import PolarChart from 'src/examples/PolarAreaExample'
33

44
describe('PolarChart', () => {
5+
let el
6+
7+
beforeEach(() => {
8+
el = document.createElement('div')
9+
})
10+
511
it('should render a canvas', () => {
612
const vm = new Vue({
7-
el: 'body',
8-
replace: false,
913
template: '<polar-chart></polar-chart>',
1014
components: { PolarChart }
11-
})
15+
}).$mount(el)
16+
1217
expect(vm.$el.querySelector('#polar-chart')).not.to.be.an('undefined')
1318
expect(vm.$el.querySelector('canvas')).not.to.be.an('undefined')
1419
expect(vm.$el.querySelector('canvas')).not.to.be.an('null')
1520
expect(vm.$el.querySelector('canvas')).to.exist
1621
})
22+
23+
it('should change id based on prop', () => {
24+
const vm = new Vue({
25+
template: '<polar-chart chartId="polarchartprop"></polar-chart>',
26+
components: { PolarChart }
27+
}).$mount(el)
28+
29+
expect(vm.$el.querySelector('#polarchartprop')).not.to.be.an('undefined')
30+
})
1731
})

test/unit/specs/Radar.spec.js

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,30 @@ import Vue from 'vue'
22
import RadarChart from 'src/examples/RadarExample'
33

44
describe('RadarChart', () => {
5+
let el
6+
7+
beforeEach(() => {
8+
el = document.createElement('div')
9+
})
10+
511
it('should render a canvas', () => {
612
const vm = new Vue({
7-
el: 'body',
8-
replace: false,
913
template: '<radar-chart></radar-chart>',
1014
components: { RadarChart }
11-
})
15+
}).$mount(el)
16+
1217
expect(vm.$el.querySelector('#radar-chart')).not.to.be.an('undefined')
1318
expect(vm.$el.querySelector('canvas')).not.to.be.an('undefined')
1419
expect(vm.$el.querySelector('canvas')).not.to.be.an('null')
1520
expect(vm.$el.querySelector('canvas')).to.exist
1621
})
22+
23+
it('should change id based on prop', () => {
24+
const vm = new Vue({
25+
template: '<radar-chart chartId="rodarchartprop"></radar-chart>',
26+
components: { RadarChart }
27+
}).$mount(el)
28+
29+
expect(vm.$el.querySelector('#rodarchartprop')).not.to.be.an('undefined')
30+
})
1731
})

0 commit comments

Comments
 (0)