mirror of
				https://github.com/KevinMidboe/vue-chartjs.git
				synced 2025-10-29 18:00:20 +00:00 
			
		
		
		
	| @@ -2,16 +2,30 @@ import Vue from 'vue' | |||||||
| import BarChart from 'src/examples/BarExample' | import BarChart from 'src/examples/BarExample' | ||||||
|  |  | ||||||
| describe('BarChart', () => { | describe('BarChart', () => { | ||||||
|  |   let el | ||||||
|  |  | ||||||
|  |   beforeEach(() => { | ||||||
|  |     el = document.createElement('div') | ||||||
|  |   }) | ||||||
|  |  | ||||||
|   it('should render a canvas', () => { |   it('should render a canvas', () => { | ||||||
|     const vm = new Vue({ |     const vm = new Vue({ | ||||||
|       el: 'body', |  | ||||||
|       replace: false, |  | ||||||
|       template: '<bar-chart></bar-chart>', |       template: '<bar-chart></bar-chart>', | ||||||
|       components: { BarChart } |       components: { BarChart } | ||||||
|     }) |     }).$mount(el) | ||||||
|  |  | ||||||
|     expect(vm.$el.querySelector('#bar-chart')).not.to.be.an('undefined') |     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('undefined') | ||||||
|     expect(vm.$el.querySelector('canvas')).not.to.be.an('null') |     expect(vm.$el.querySelector('canvas')).not.to.be.an('null') | ||||||
|     expect(vm.$el.querySelector('canvas')).to.exist |     expect(vm.$el.querySelector('canvas')).to.exist | ||||||
|   }) |   }) | ||||||
|  |  | ||||||
|  |   it('should change id based on prop', () => { | ||||||
|  |     const vm = new Vue({ | ||||||
|  |       template: '<bar-chart chartId="barchartprop"></bar-chart>', | ||||||
|  |       components: { BarChart } | ||||||
|  |     }).$mount(el) | ||||||
|  |  | ||||||
|  |     expect(vm.$el.querySelector('#barchartprop')).not.to.be.an('undefined') | ||||||
|  |   }) | ||||||
| }) | }) | ||||||
|   | |||||||
| @@ -2,16 +2,30 @@ import Vue from 'vue' | |||||||
| import BubbleChart from 'src/examples/BubbleExample' | import BubbleChart from 'src/examples/BubbleExample' | ||||||
|  |  | ||||||
| describe('BubbleChart', () => { | describe('BubbleChart', () => { | ||||||
|  |   let el | ||||||
|  |  | ||||||
|  |   beforeEach(() => { | ||||||
|  |     el = document.createElement('div') | ||||||
|  |   }) | ||||||
|  |  | ||||||
|   it('should render a canvas', () => { |   it('should render a canvas', () => { | ||||||
|     const vm = new Vue({ |     const vm = new Vue({ | ||||||
|       el: 'body', |  | ||||||
|       replace: false, |  | ||||||
|       template: '<bubble-chart></bubble-chart>', |       template: '<bubble-chart></bubble-chart>', | ||||||
|       components: { BubbleChart } |       components: { BubbleChart } | ||||||
|     }) |     }).$mount(el) | ||||||
|  |  | ||||||
|     expect(vm.$el.querySelector('#bubble-chart')).not.to.be.an('undefined') |     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('undefined') | ||||||
|     expect(vm.$el.querySelector('canvas')).not.to.be.an('null') |     expect(vm.$el.querySelector('canvas')).not.to.be.an('null') | ||||||
|     expect(vm.$el.querySelector('canvas')).to.exist |     expect(vm.$el.querySelector('canvas')).to.exist | ||||||
|   }) |   }) | ||||||
|  |  | ||||||
|  |   it('should change id based on prop', () => { | ||||||
|  |     const vm = new Vue({ | ||||||
|  |       template: '<bubble-chart chartId="bubblechartprop"></bubble-chart>', | ||||||
|  |       components: { BubbleChart } | ||||||
|  |     }).$mount(el) | ||||||
|  |  | ||||||
|  |     expect(vm.$el.querySelector('#bubblechartprop')).not.to.be.an('undefined') | ||||||
|  |   }) | ||||||
| }) | }) | ||||||
|   | |||||||
| @@ -2,16 +2,30 @@ import Vue from 'vue' | |||||||
| import DoughnutChart from 'src/examples/DoughnutExample' | import DoughnutChart from 'src/examples/DoughnutExample' | ||||||
|  |  | ||||||
| describe('DoughnutChart', () => { | describe('DoughnutChart', () => { | ||||||
|  |   let el | ||||||
|  |  | ||||||
|  |   beforeEach(() => { | ||||||
|  |     el = document.createElement('div') | ||||||
|  |   }) | ||||||
|  |  | ||||||
|   it('should render a canvas', () => { |   it('should render a canvas', () => { | ||||||
|     const vm = new Vue({ |     const vm = new Vue({ | ||||||
|       el: 'body', |  | ||||||
|       replace: false, |  | ||||||
|       template: '<doughnut-chart></doughnut-chart>', |       template: '<doughnut-chart></doughnut-chart>', | ||||||
|       components: { DoughnutChart } |       components: { DoughnutChart } | ||||||
|     }) |     }).$mount(el) | ||||||
|  |  | ||||||
|     expect(vm.$el.querySelector('#doughnut-chart')).not.to.be.an('undefined') |     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('undefined') | ||||||
|     expect(vm.$el.querySelector('canvas')).not.to.be.an('null') |     expect(vm.$el.querySelector('canvas')).not.to.be.an('null') | ||||||
|     expect(vm.$el.querySelector('canvas')).to.exist |     expect(vm.$el.querySelector('canvas')).to.exist | ||||||
|   }) |   }) | ||||||
|  |  | ||||||
|  |   it('should change id based on prop', () => { | ||||||
|  |     const vm = new Vue({ | ||||||
|  |       template: '<doughnut-chart chartId="doughnutchartprop"></doughnut-chart>', | ||||||
|  |       components: { DoughnutChart } | ||||||
|  |     }).$mount(el) | ||||||
|  |  | ||||||
|  |     expect(vm.$el.querySelector('#doughnutchartprop')).not.to.be.an('undefined') | ||||||
|  |   }) | ||||||
| }) | }) | ||||||
|   | |||||||
| @@ -2,16 +2,30 @@ import Vue from 'vue' | |||||||
| import LineChart from 'src/examples/LineExample' | import LineChart from 'src/examples/LineExample' | ||||||
|  |  | ||||||
| describe('LineChart', () => { | describe('LineChart', () => { | ||||||
|  |   let el | ||||||
|  |  | ||||||
|  |   beforeEach(() => { | ||||||
|  |     el = document.createElement('div') | ||||||
|  |   }) | ||||||
|  |  | ||||||
|   it('should render a canvas', () => { |   it('should render a canvas', () => { | ||||||
|     const vm = new Vue({ |     const vm = new Vue({ | ||||||
|       el: 'body', |  | ||||||
|       replace: false, |  | ||||||
|       template: '<line-chart></line-chart>', |       template: '<line-chart></line-chart>', | ||||||
|       components: { LineChart } |       components: { LineChart } | ||||||
|     }) |     }).$mount(el) | ||||||
|  |  | ||||||
|     expect(vm.$el.querySelector('#line-chart')).not.to.be.an('undefined') |     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('undefined') | ||||||
|     expect(vm.$el.querySelector('canvas')).not.to.be.an('null') |     expect(vm.$el.querySelector('canvas')).not.to.be.an('null') | ||||||
|     expect(vm.$el.querySelector('canvas')).to.exist |     expect(vm.$el.querySelector('canvas')).to.exist | ||||||
|   }) |   }) | ||||||
|  |  | ||||||
|  |   it('should change id based on prop', () => { | ||||||
|  |     const vm = new Vue({ | ||||||
|  |       template: '<line-chart chartId="linechartprop"></line-chart>', | ||||||
|  |       components: { LineChart } | ||||||
|  |     }).$mount(el) | ||||||
|  |  | ||||||
|  |     expect(vm.$el.querySelector('#linechartprop')).not.to.be.an('undefined') | ||||||
|  |   }) | ||||||
| }) | }) | ||||||
|   | |||||||
| @@ -2,16 +2,30 @@ import Vue from 'vue' | |||||||
| import PieChart from 'src/examples/PieExample' | import PieChart from 'src/examples/PieExample' | ||||||
|  |  | ||||||
| describe('PieChart', () => { | describe('PieChart', () => { | ||||||
|  |   let el | ||||||
|  |  | ||||||
|  |   beforeEach(() => { | ||||||
|  |     el = document.createElement('div') | ||||||
|  |   }) | ||||||
|  |  | ||||||
|   it('should render a canvas', () => { |   it('should render a canvas', () => { | ||||||
|     const vm = new Vue({ |     const vm = new Vue({ | ||||||
|       el: 'body', |  | ||||||
|       replace: false, |  | ||||||
|       template: '<pie-chart></pie-chart>', |       template: '<pie-chart></pie-chart>', | ||||||
|       components: { PieChart } |       components: { PieChart } | ||||||
|     }) |     }).$mount(el) | ||||||
|  |  | ||||||
|     expect(vm.$el.querySelector('#pie-chart')).not.to.be.an('undefined') |     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('undefined') | ||||||
|     expect(vm.$el.querySelector('canvas')).not.to.be.an('null') |     expect(vm.$el.querySelector('canvas')).not.to.be.an('null') | ||||||
|     expect(vm.$el.querySelector('canvas')).to.exist |     expect(vm.$el.querySelector('canvas')).to.exist | ||||||
|   }) |   }) | ||||||
|  |  | ||||||
|  |   it('should change id based on prop', () => { | ||||||
|  |     const vm = new Vue({ | ||||||
|  |       template: '<pie-chart chartId="piechartprop"></pie-chart>', | ||||||
|  |       components: { PieChart } | ||||||
|  |     }).$mount(el) | ||||||
|  |  | ||||||
|  |     expect(vm.$el.querySelector('#piechartprop')).not.to.be.an('undefined') | ||||||
|  |   }) | ||||||
| }) | }) | ||||||
|   | |||||||
| @@ -2,16 +2,30 @@ import Vue from 'vue' | |||||||
| import PolarChart from 'src/examples/PolarAreaExample' | import PolarChart from 'src/examples/PolarAreaExample' | ||||||
|  |  | ||||||
| describe('PolarChart', () => { | describe('PolarChart', () => { | ||||||
|  |   let el | ||||||
|  |  | ||||||
|  |   beforeEach(() => { | ||||||
|  |     el = document.createElement('div') | ||||||
|  |   }) | ||||||
|  |  | ||||||
|   it('should render a canvas', () => { |   it('should render a canvas', () => { | ||||||
|     const vm = new Vue({ |     const vm = new Vue({ | ||||||
|       el: 'body', |  | ||||||
|       replace: false, |  | ||||||
|       template: '<polar-chart></polar-chart>', |       template: '<polar-chart></polar-chart>', | ||||||
|       components: { PolarChart } |       components: { PolarChart } | ||||||
|     }) |     }).$mount(el) | ||||||
|  |  | ||||||
|     expect(vm.$el.querySelector('#polar-chart')).not.to.be.an('undefined') |     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('undefined') | ||||||
|     expect(vm.$el.querySelector('canvas')).not.to.be.an('null') |     expect(vm.$el.querySelector('canvas')).not.to.be.an('null') | ||||||
|     expect(vm.$el.querySelector('canvas')).to.exist |     expect(vm.$el.querySelector('canvas')).to.exist | ||||||
|   }) |   }) | ||||||
|  |  | ||||||
|  |   it('should change id based on prop', () => { | ||||||
|  |     const vm = new Vue({ | ||||||
|  |       template: '<polar-chart chartId="polarchartprop"></polar-chart>', | ||||||
|  |       components: { PolarChart } | ||||||
|  |     }).$mount(el) | ||||||
|  |  | ||||||
|  |     expect(vm.$el.querySelector('#polarchartprop')).not.to.be.an('undefined') | ||||||
|  |   }) | ||||||
| }) | }) | ||||||
|   | |||||||
| @@ -2,16 +2,30 @@ import Vue from 'vue' | |||||||
| import RadarChart from 'src/examples/RadarExample' | import RadarChart from 'src/examples/RadarExample' | ||||||
|  |  | ||||||
| describe('RadarChart', () => { | describe('RadarChart', () => { | ||||||
|  |   let el | ||||||
|  |  | ||||||
|  |   beforeEach(() => { | ||||||
|  |     el = document.createElement('div') | ||||||
|  |   }) | ||||||
|  |  | ||||||
|   it('should render a canvas', () => { |   it('should render a canvas', () => { | ||||||
|     const vm = new Vue({ |     const vm = new Vue({ | ||||||
|       el: 'body', |  | ||||||
|       replace: false, |  | ||||||
|       template: '<radar-chart></radar-chart>', |       template: '<radar-chart></radar-chart>', | ||||||
|       components: { RadarChart } |       components: { RadarChart } | ||||||
|     }) |     }).$mount(el) | ||||||
|  |  | ||||||
|     expect(vm.$el.querySelector('#radar-chart')).not.to.be.an('undefined') |     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('undefined') | ||||||
|     expect(vm.$el.querySelector('canvas')).not.to.be.an('null') |     expect(vm.$el.querySelector('canvas')).not.to.be.an('null') | ||||||
|     expect(vm.$el.querySelector('canvas')).to.exist |     expect(vm.$el.querySelector('canvas')).to.exist | ||||||
|   }) |   }) | ||||||
|  |  | ||||||
|  |   it('should change id based on prop', () => { | ||||||
|  |     const vm = new Vue({ | ||||||
|  |       template: '<radar-chart chartId="rodarchartprop"></radar-chart>', | ||||||
|  |       components: { RadarChart } | ||||||
|  |     }).$mount(el) | ||||||
|  |  | ||||||
|  |     expect(vm.$el.querySelector('#rodarchartprop')).not.to.be.an('undefined') | ||||||
|  |   }) | ||||||
| }) | }) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user