mirror of
				https://github.com/KevinMidboe/vue-chartjs.git
				synced 2025-10-29 18:00:20 +00:00 
			
		
		
		
	✅ Add unit tests and travis.yml
This commit is contained in:
		
							
								
								
									
										17
									
								
								test/unit/specs/Bar.spec.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								test/unit/specs/Bar.spec.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,17 @@ | ||||
| import Vue from 'vue' | ||||
| import BarChart from 'src/examples/BarExample' | ||||
|  | ||||
| describe('BarChart', () => { | ||||
|   it('should render a canvas', () => { | ||||
|     const vm = new Vue({ | ||||
|       el: 'body', | ||||
|       replace: false, | ||||
|       template: '<bar-chart></bar-chart>', | ||||
|       components: { BarChart } | ||||
|     }) | ||||
|     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 | ||||
|   }) | ||||
| }) | ||||
							
								
								
									
										17
									
								
								test/unit/specs/Bubble.spec.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								test/unit/specs/Bubble.spec.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,17 @@ | ||||
| import Vue from 'vue' | ||||
| import BubbleChart from 'src/examples/BubbleExample' | ||||
|  | ||||
| describe('BubbleChart', () => { | ||||
|   it('should render a canvas', () => { | ||||
|     const vm = new Vue({ | ||||
|       el: 'body', | ||||
|       replace: false, | ||||
|       template: '<bubble-chart></bubble-chart>', | ||||
|       components: { BubbleChart } | ||||
|     }) | ||||
|     expect(vm.$el.querySelector('#bubble-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 | ||||
|   }) | ||||
| }) | ||||
							
								
								
									
										17
									
								
								test/unit/specs/Doughnut.spec.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								test/unit/specs/Doughnut.spec.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,17 @@ | ||||
| import Vue from 'vue' | ||||
| import DoughnutChart from 'src/examples/DoughnutExample' | ||||
|  | ||||
| describe('DoughnutChart', () => { | ||||
|   it('should render a canvas', () => { | ||||
|     const vm = new Vue({ | ||||
|       el: 'body', | ||||
|       replace: false, | ||||
|       template: '<doughnut-chart></doughnut-chart>', | ||||
|       components: { DoughnutChart } | ||||
|     }) | ||||
|     expect(vm.$el.querySelector('#doughnut-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 | ||||
|   }) | ||||
| }) | ||||
							
								
								
									
										17
									
								
								test/unit/specs/Line.spec.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								test/unit/specs/Line.spec.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,17 @@ | ||||
| import Vue from 'vue' | ||||
| import LineChart from 'src/examples/LineExample' | ||||
|  | ||||
| describe('LineChart', () => { | ||||
|   it('should render a canvas', () => { | ||||
|     const vm = new Vue({ | ||||
|       el: 'body', | ||||
|       replace: false, | ||||
|       template: '<line-chart></line-chart>', | ||||
|       components: { LineChart } | ||||
|     }) | ||||
|     expect(vm.$el.querySelector('#line-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 | ||||
|   }) | ||||
| }) | ||||
							
								
								
									
										17
									
								
								test/unit/specs/Pie.spec.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								test/unit/specs/Pie.spec.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,17 @@ | ||||
| import Vue from 'vue' | ||||
| import PieChart from 'src/examples/PieExample' | ||||
|  | ||||
| describe('PieChart', () => { | ||||
|   it('should render a canvas', () => { | ||||
|     const vm = new Vue({ | ||||
|       el: 'body', | ||||
|       replace: false, | ||||
|       template: '<pie-chart></pie-chart>', | ||||
|       components: { PieChart } | ||||
|     }) | ||||
|     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 | ||||
|   }) | ||||
| }) | ||||
							
								
								
									
										17
									
								
								test/unit/specs/PolarArea.spec.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								test/unit/specs/PolarArea.spec.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,17 @@ | ||||
| import Vue from 'vue' | ||||
| import PolarChart from 'src/examples/PolarAreaExample' | ||||
|  | ||||
| describe('PolarChart', () => { | ||||
|   it('should render a canvas', () => { | ||||
|     const vm = new Vue({ | ||||
|       el: 'body', | ||||
|       replace: false, | ||||
|       template: '<polar-chart></polar-chart>', | ||||
|       components: { PolarChart } | ||||
|     }) | ||||
|     expect(vm.$el.querySelector('#polar-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 | ||||
|   }) | ||||
| }) | ||||
							
								
								
									
										17
									
								
								test/unit/specs/Radar.spec.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								test/unit/specs/Radar.spec.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,17 @@ | ||||
| import Vue from 'vue' | ||||
| import RadarChart from 'src/examples/RadarExample' | ||||
|  | ||||
| describe('RadarChart', () => { | ||||
|   it('should render a canvas', () => { | ||||
|     const vm = new Vue({ | ||||
|       el: 'body', | ||||
|       replace: false, | ||||
|       template: '<radar-chart></radar-chart>', | ||||
|       components: { RadarChart } | ||||
|     }) | ||||
|     expect(vm.$el.querySelector('#radar-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 | ||||
|   }) | ||||
| }) | ||||
							
								
								
									
										30
									
								
								test/unit/specs/helpers/options.spec.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								test/unit/specs/helpers/options.spec.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,30 @@ | ||||
| import { mergeOptions } from 'src/helpers/options' | ||||
|  | ||||
| describe('mergeOptions.js', () => { | ||||
|   const a = { | ||||
|     a: 'a', | ||||
|     b: 'a' | ||||
|   } | ||||
|  | ||||
|   const b = { | ||||
|     a: 'b', | ||||
|     b: 'b' | ||||
|   } | ||||
|  | ||||
|   const c = { | ||||
|     c: 'c' | ||||
|   } | ||||
|  | ||||
|   it('should replace old a and b if a and b are new', () => { | ||||
|     let ab = mergeOptions(a, b) | ||||
|     expect(ab).to.have.property('a').and.to.equal('b') | ||||
|     expect(ab).to.have.property('b').and.to.equal('b') | ||||
|   }) | ||||
|  | ||||
|   it('should add c if c is new', () => { | ||||
|     let ac = mergeOptions(a, c) | ||||
|     expect(ac).to.have.property('a').and.to.equal('a') | ||||
|     expect(ac).to.have.property('b').and.to.equal('a') | ||||
|     expect(ac).to.have.property('c').and.to.equal('c') | ||||
|   }) | ||||
| }) | ||||
		Reference in New Issue
	
	Block a user