forked from apertureless/vue-chartjs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Radar.spec.ts
43 lines (34 loc) · 1.15 KB
/
Radar.spec.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import { mount } from '@vue/test-utils'
import RadarChart from './examples/RadarChart'
describe('RadarChart', () => {
const Component = {
template: '<div><RadarChart :chartId="chartId" :plugins="plugins" /></div>',
components: { RadarChart },
props: ['chartId', 'plugins']
}
it('should render a canvas', () => {
const wrapper = mount(Component)
const radarChartEl = wrapper.find('#radar-chart')
expect(radarChartEl.element.id).not.toBe('undefined')
expect(radarChartEl.exists()).toBe(true)
const canvasEl = wrapper.find('canvas')
expect(canvasEl.exists()).toBe(true)
})
it('should change id based on prop', () => {
const wrapper = mount(Component, {
props: { chartId: 'rodarchartprop' }
})
const radarChartEl = wrapper.find('#rodarchartprop')
expect(radarChartEl.element.id).not.toBe('undefined')
expect(radarChartEl.exists()).toBe(true)
})
it('should add inline plugins based on prop', () => {
const testPlugin = {
id: 'test'
}
const wrapper = mount(Component, {
props: { plugins: [testPlugin] }
})
expect(wrapper.props().plugins.length).toEqual(1)
})
})