Skip to content

Commit 74cedd4

Browse files
committed
✅ Add tests
1 parent d6c3f50 commit 74cedd4

File tree

9 files changed

+149
-12
lines changed

9 files changed

+149
-12
lines changed

test/unit/specs/Bar.spec.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import Vue from 'vue'
2+
import BarChart from 'src/examples/BarExample'
3+
4+
describe('BarChart', () => {
5+
it('should render a canvas', () => {
6+
const vm = new Vue({
7+
el: 'body',
8+
replace: false,
9+
template: '<bar-chart></bar-chart>',
10+
components: { BarChart }
11+
})
12+
expect(vm.$el.querySelector('#bar-chart')).not.to.be.an('undefined')
13+
expect(vm.$el.querySelector('canvas')).not.to.be.an('undefined')
14+
expect(vm.$el.querySelector('canvas')).not.to.be.an('null')
15+
expect(vm.$el.querySelector('canvas')).to.exist
16+
})
17+
})

test/unit/specs/Bubble.spec.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import Vue from 'vue'
2+
import BubbleChart from 'src/examples/BubbleExample'
3+
4+
describe('BubbleChart', () => {
5+
it('should render a canvas', () => {
6+
const vm = new Vue({
7+
el: 'body',
8+
replace: false,
9+
template: '<bubble-chart></bubble-chart>',
10+
components: { BubbleChart }
11+
})
12+
expect(vm.$el.querySelector('#bubble-chart')).not.to.be.an('undefined')
13+
expect(vm.$el.querySelector('canvas')).not.to.be.an('undefined')
14+
expect(vm.$el.querySelector('canvas')).not.to.be.an('null')
15+
expect(vm.$el.querySelector('canvas')).to.exist
16+
})
17+
})

test/unit/specs/Doughnut.spec.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import Vue from 'vue'
2+
import DoughnutChart from 'src/examples/DoughnutExample'
3+
4+
describe('DoughnutChart', () => {
5+
it('should render a canvas', () => {
6+
const vm = new Vue({
7+
el: 'body',
8+
replace: false,
9+
template: '<doughnut-chart></doughnut-chart>',
10+
components: { DoughnutChart }
11+
})
12+
expect(vm.$el.querySelector('#doughnut-chart')).not.to.be.an('undefined')
13+
expect(vm.$el.querySelector('canvas')).not.to.be.an('undefined')
14+
expect(vm.$el.querySelector('canvas')).not.to.be.an('null')
15+
expect(vm.$el.querySelector('canvas')).to.exist
16+
})
17+
})

test/unit/specs/Hello.spec.js

Lines changed: 0 additions & 12 deletions
This file was deleted.

test/unit/specs/Line.spec.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import Vue from 'vue'
2+
import LineChart from 'src/examples/LineExample'
3+
4+
describe('LineChart', () => {
5+
it('should render a canvas', () => {
6+
const vm = new Vue({
7+
el: 'body',
8+
replace: false,
9+
template: '<line-chart></line-chart>',
10+
components: { LineChart }
11+
})
12+
expect(vm.$el.querySelector('#line-chart')).not.to.be.an('undefined')
13+
expect(vm.$el.querySelector('canvas')).not.to.be.an('undefined')
14+
expect(vm.$el.querySelector('canvas')).not.to.be.an('null')
15+
expect(vm.$el.querySelector('canvas')).to.exist
16+
})
17+
})

test/unit/specs/Pie.spec.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import Vue from 'vue'
2+
import PieChart from 'src/examples/PieExample'
3+
4+
describe('PieChart', () => {
5+
it('should render a canvas', () => {
6+
const vm = new Vue({
7+
el: 'body',
8+
replace: false,
9+
template: '<pie-chart></pie-chart>',
10+
components: { PieChart }
11+
})
12+
expect(vm.$el.querySelector('#pie-chart')).not.to.be.an('undefined')
13+
expect(vm.$el.querySelector('canvas')).not.to.be.an('undefined')
14+
expect(vm.$el.querySelector('canvas')).not.to.be.an('null')
15+
expect(vm.$el.querySelector('canvas')).to.exist
16+
})
17+
})

test/unit/specs/PolarArea.spec.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import Vue from 'vue'
2+
import PolarChart from 'src/examples/PolarAreaExample'
3+
4+
describe('PolarChart', () => {
5+
it('should render a canvas', () => {
6+
const vm = new Vue({
7+
el: 'body',
8+
replace: false,
9+
template: '<polar-chart></polar-chart>',
10+
components: { PolarChart }
11+
})
12+
expect(vm.$el.querySelector('#polar-chart')).not.to.be.an('undefined')
13+
expect(vm.$el.querySelector('canvas')).not.to.be.an('undefined')
14+
expect(vm.$el.querySelector('canvas')).not.to.be.an('null')
15+
expect(vm.$el.querySelector('canvas')).to.exist
16+
})
17+
})

test/unit/specs/Radar.spec.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import Vue from 'vue'
2+
import RadarChart from 'src/examples/RadarExample'
3+
4+
describe('RadarChart', () => {
5+
it('should render a canvas', () => {
6+
const vm = new Vue({
7+
el: 'body',
8+
replace: false,
9+
template: '<radar-chart></radar-chart>',
10+
components: { RadarChart }
11+
})
12+
expect(vm.$el.querySelector('#radar-chart')).not.to.be.an('undefined')
13+
expect(vm.$el.querySelector('canvas')).not.to.be.an('undefined')
14+
expect(vm.$el.querySelector('canvas')).not.to.be.an('null')
15+
expect(vm.$el.querySelector('canvas')).to.exist
16+
})
17+
})
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import { mergeOptions } from 'src/helpers/options'
2+
3+
describe('mergeOptions.js', () => {
4+
const a = {
5+
a: 'a',
6+
b: 'a'
7+
}
8+
9+
const b = {
10+
a: 'b',
11+
b: 'b'
12+
}
13+
14+
const c = {
15+
c: 'c'
16+
}
17+
18+
it('should replace old a and b if a and b are new', () => {
19+
let ab = mergeOptions(a, b)
20+
expect(ab).to.have.property('a').and.to.equal('b')
21+
expect(ab).to.have.property('b').and.to.equal('b')
22+
})
23+
24+
it('should add c if c is new', () => {
25+
let ac = mergeOptions(a, c)
26+
expect(ac).to.have.property('a').and.to.equal('a')
27+
expect(ac).to.have.property('b').and.to.equal('a')
28+
expect(ac).to.have.property('c').and.to.equal('c')
29+
})
30+
})

0 commit comments

Comments
 (0)