Skip to content

Commit 2de14ad

Browse files
committed
test: fix line chart test case
1 parent dba197a commit 2de14ad

File tree

1 file changed

+29
-21
lines changed

1 file changed

+29
-21
lines changed

__tests__/plots/line.spec.tsx

Lines changed: 29 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,7 @@ import LineChart from '../../src/plots/line'
33

44
describe('LineChart', () => {
55
test('render without crashed', () => {
6-
mount(LineChart, {
7-
props: {
8-
data: [],
9-
},
10-
})
6+
mount(<LineChart data={[]} />)
117
})
128

139
test('test update config and data', async () => {
@@ -17,63 +13,75 @@ describe('LineChart', () => {
1713
const handleLineClick2 = () => {
1814
console.log(2)
1915
}
20-
const wrapper = mount(LineChart, {
21-
props: {
22-
data: null,
23-
},
24-
})
16+
const wrapper = mount(<LineChart data={null} />)
2517

2618
await wrapper.setProps({
27-
forceFit: true,
19+
autoFit: true,
2820
data: [],
21+
xField: 'x',
22+
yField: 'y',
2923
})
3024
await wrapper.setProps({
31-
forceFit: true,
25+
autoFit: true,
3226
data: null,
27+
xField: 'x',
28+
yField: 'y',
3329
})
3430

3531
await wrapper.setProps({
36-
forceFit: true,
32+
autoFit: true,
3733
data: [{ x: 1 }],
34+
xField: 'x',
35+
yField: 'y',
3836
})
3937

4038
await wrapper.setProps({
41-
forceFit: true,
39+
autoFit: true,
4240
data: [{ x: 2 }],
41+
xField: 'x',
42+
yField: 'y',
4343
})
4444

4545
await wrapper.setProps({
46-
forceFit: true,
46+
autoFit: true,
47+
xField: 'x',
48+
yField: 'y',
4749
})
4850

4951
await wrapper.setProps({
5052
data: [],
51-
forceFit: true,
53+
autoFit: true,
5254
xAxis: {
53-
visible: true,
55+
nice: true,
5456
},
57+
xField: 'x',
58+
yField: 'y',
5559
events: {
5660
onLineClick: handleLineClick1,
5761
},
5862
})
5963

6064
await wrapper.setProps({
6165
data: [],
62-
forceFit: true,
66+
autoFit: true,
6367
xAxis: {
64-
visible: true,
68+
nice: true,
6569
},
70+
xField: 'x',
71+
yField: 'y',
6672
events: {
6773
onLineClick: handleLineClick2,
6874
},
6975
})
7076

7177
await wrapper.setProps({
7278
data: [],
73-
forceFit: true,
79+
autoFit: true,
7480
xAxis: {
75-
visible: true,
81+
nice: true,
7682
},
83+
xField: 'x',
84+
yField: 'y',
7785
events: {
7886
onLineClick: handleLineClick2,
7987
},

0 commit comments

Comments
 (0)