forked from ElemeFE/v-charts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
78 lines (72 loc) · 1.46 KB
/
index.js
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/* eslint-disable no-undef */
import Vue from 'vue'
import chartData from '../examples/data/index.js'
import 'echarts/lib/component/tooltip'
import 'echarts/lib/component/legend'
import {
VeLine,
VeBar,
VeHistogram,
VePie,
VeRing,
VeFunnel,
VeRadar,
VeWaterfall,
VeChart,
VeMap,
VeSankey,
VeHeatmap,
VeScatter,
VeCandle,
VeGauge,
VeLiquidfill,
VeWordcloud
} from '../lib/index.esm'
window.Promise = require('es6-promise').Promise
const comps = {
line: VeLine,
bar: VeBar,
histogram: VeHistogram,
pie: VePie,
ring: VeRing,
funnel: VeFunnel,
radar: VeRadar,
waterfall: VeWaterfall,
chart: VeChart,
map: VeMap,
sankey: VeSankey,
heatmap: VeHeatmap,
scatter: VeScatter,
candle: VeCandle,
gauge: VeGauge,
liquidfill: VeLiquidfill,
wordcloud: VeWordcloud
}
let box
let vm = {}
createBox()
afterEach(() => {
if (vm.$el) document.body.removeChild(vm.$el)
createBox()
})
Object.keys(comps).forEach(type => {
chartData[type].data.forEach(item => {
describe(type + ': ', () => {
testMount(type, comps[type], item)
})
})
})
function testMount (type, comp, item) {
it(item.name, () => {
const Ctor = Vue.extend(comp)
const vm = new Ctor({
propsData: { data: item.data, settings: item.settings }
}).$mount(box)
expect(vm.$el.classList.contains('ve-' + type)).toEqual(true)
})
}
function createBox () {
box = document.createElement('div')
box.id = 'app'
document.body.appendChild(box)
}