forked from apertureless/vue-chartjs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPolarArea.spec.ts
44 lines (35 loc) · 1.19 KB
/
PolarArea.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
44
import { mount } from '@vue/test-utils'
import PolarAreaChart from './examples/PolarAreaChart'
describe('PolarChart', () => {
const Component = {
template:
'<div><PolarAreaChart :chartId="chartId" :plugins="plugins" /></div>',
components: { PolarAreaChart },
props: ['chartId', 'plugins']
}
it('should render a canvas', () => {
const wrapper = mount(Component)
const polarAreaChartEl = wrapper.find('#polar-chart')
expect(polarAreaChartEl.element.id).not.toBe('undefined')
expect(polarAreaChartEl.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: 'polarchartprop' }
})
const polarAreaChartEl = wrapper.find('#polarchartprop')
expect(polarAreaChartEl.element.id).not.toBe('undefined')
expect(polarAreaChartEl.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)
})
})