Skip to content

Commit 8a512c9

Browse files
committed
test: update test case
1 parent e71643c commit 8a512c9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+97
-423
lines changed

__tests__/plots/bubble.spec.tsx

-14
This file was deleted.

__tests__/plots/bullet.spec.tsx

+48-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,55 @@
11
import { mount } from '@vue/test-utils'
22
import BulletChart from '../../src/plots/bullet'
33

4+
const props: any = {
5+
data: [
6+
{
7+
title: '满意度',
8+
ranges: [100],
9+
measures: [80],
10+
target: 85,
11+
},
12+
],
13+
measureField: 'measures',
14+
rangeField: 'ranges',
15+
targetField: 'target',
16+
xField: 'title',
17+
style: {
18+
range: {
19+
color: '#5B8FF9',
20+
},
21+
measure: {
22+
color: '#5B8FF9',
23+
},
24+
target: {
25+
color: '#5B8FF9',
26+
},
27+
},
28+
xAxis: {
29+
line: null,
30+
},
31+
yAxis: false,
32+
// 自定义 legend
33+
legend: {
34+
custom: true,
35+
position: 'left',
36+
items: [
37+
{
38+
value: '实际值',
39+
name: '实际值',
40+
marker: { symbol: 'square', style: { fill: '#5B8FF9', r: 5 } },
41+
},
42+
{
43+
value: '目标值',
44+
name: '目标值',
45+
marker: { symbol: 'line', style: { stroke: '#5B8FF9', r: 5 } },
46+
},
47+
],
48+
},
49+
}
50+
451
describe('BulletChart', () => {
552
test('should render without crashed', () => {
6-
mount(BulletChart, {
7-
props: {},
8-
})
53+
mount(() => <BulletChart {...props} />)
954
})
1055
})

__tests__/plots/calendar.spec.tsx

-16
This file was deleted.

__tests__/plots/column-line.spec.tsx

-10
This file was deleted.

__tests__/plots/density-heatmap.spec.tsx

-10
This file was deleted.

__tests__/plots/density.spec.tsx

-10
This file was deleted.

__tests__/plots/donut.spec.tsx

-10
This file was deleted.

__tests__/plots/dual-line.spec.tsx

-10
This file was deleted.

__tests__/plots/fan-guage.spec.tsx

-10
This file was deleted.

__tests__/plots/funnel.spec.tsx

+3-5
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
import { mount } from '@vue/test-utils'
2-
import Chart from '../../src/plots/funnel'
2+
import FunnelChart from '../../src/plots/funnel'
33

4-
describe('Chart', () => {
4+
describe('FunnelChart', () => {
55
test('should render without crashed', () => {
6-
mount(Chart, {
7-
props: {},
8-
})
6+
mount(() => <FunnelChart data={[{ x: 'a', y: 1 }]} xField="x" yField="y" />)
97
})
108
})

__tests__/plots/grouped-bar.spec.tsx

-10
This file was deleted.

__tests__/plots/grouped-column-line.spec.tsx

-10
This file was deleted.

__tests__/plots/grouped-column.spec.tsx

-10
This file was deleted.

__tests__/plots/grouped-rose.spec.tsx

-10
This file was deleted.

__tests__/plots/histogram.spec.tsx

+6-3
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,11 @@ import Chart from '../../src/plots/histogram'
33

44
describe('Chart', () => {
55
test('should render without crashed', () => {
6-
mount(Chart, {
7-
props: {},
8-
})
6+
const config = {
7+
data: [],
8+
binField: 'value',
9+
binWidth: 2,
10+
}
11+
mount(<Chart {...config} />)
912
})
1013
})

__tests__/plots/liquid.spec.tsx

+4-12
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,10 @@
11
import { mount } from '@vue/test-utils'
2-
import Chart from '../../src/plots/liquid'
2+
import LiquidChart from '../../src/plots/liquid'
33

4-
describe('Chart', () => {
4+
describe('LiquidChart', () => {
55
test('should render without crashed', () => {
6-
mount(Chart, {
7-
props: {
8-
title: {
9-
visible: true,
10-
text: '水波图',
11-
},
12-
min: 0,
13-
max: 10000,
14-
value: 5639,
15-
},
6+
mount(LiquidChart, {
7+
props: {},
168
})
179
})
1810
})

__tests__/plots/meter-gauge.spec.tsx

-10
This file was deleted.

__tests__/plots/percent-stacked-area.spec.tsx

-39
This file was deleted.

__tests__/plots/percent-stacked-bar.spec.tsx

-10
This file was deleted.

__tests__/plots/percent-stacked-column.spec.tsx

-10
This file was deleted.

__tests__/plots/progress.spec.tsx

+3-15
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,10 @@
11
import { mount } from '@vue/test-utils'
22
import Chart from '../../src/plots/progress'
33

4-
const config = {
5-
width: 50,
6-
height: 50,
7-
percent: 50,
8-
color: (v) => {
9-
if (v < 0.3) {
10-
return ['#30BF78', '#E8EDF3']
11-
} else if (v >= 0.3 && v < 0.7) {
12-
return ['#FAAD14', '#E8EDF3']
13-
}
14-
return ['#F4664A', '#E8EDF3']
15-
},
16-
}
17-
184
describe('Chart', () => {
195
test('should render without crashed', () => {
20-
mount(() => <Chart {...config} />)
6+
mount(Chart, {
7+
props: {},
8+
})
219
})
2210
})

__tests__/plots/range-bar.spec.tsx

-10
This file was deleted.

__tests__/plots/range-column.spec.tsx

-10
This file was deleted.

__tests__/plots/ring-progress.spec.tsx

+1-13
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,7 @@
11
import { mount } from '@vue/test-utils'
22
import Chart from '../../src/plots/ring-progress'
33

4-
const config = {
5-
width: 50,
6-
height: 50,
7-
percent: 50,
8-
color: (v) => {
9-
if (v < 0.3) {
10-
return ['#30BF78', '#E8EDF3']
11-
} else if (v >= 0.3 && v < 0.7) {
12-
return ['#FAAD14', '#E8EDF3']
13-
}
14-
return ['#F4664A', '#E8EDF3']
15-
},
16-
}
4+
const config = {}
175

186
describe('Chart', () => {
197
test('should render without crashed', () => {

0 commit comments

Comments
 (0)