Skip to content

Commit 0bfdf77

Browse files
author
hy
committed
fix(Progress) 优化Progress组件示例展示和解决test报错
1 parent 984ca40 commit 0bfdf77

File tree

2 files changed

+15
-32
lines changed

2 files changed

+15
-32
lines changed

example/examples/src/routes/Progress/index.tsx

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ const ProgressDemo = (props: any) => {
2626
<Header title={title} description={description} />
2727
<Body style={{ paddingLeft: 16, paddingRight: 16 }}>
2828
<Card title="基础实例">
29-
<Progress type='circle' />
29+
<Progress type='circle' value={60} />
3030
<Spacing />
31-
<Progress type='line' />
31+
<Progress type='line' value={60} />
3232
</Card>
3333
<Card title="自定义值">
3434
<Progress type='circle' value={val} />
@@ -38,28 +38,28 @@ const ProgressDemo = (props: any) => {
3838
<Button onPress={() => onPress()} >你点我呀!</Button>
3939
</Card>
4040
<Card title="自定义渐变色">
41-
<Progress type='circle' color={['#FFD080', 'red']} />
41+
<Progress type='circle' color={['#FFD080', 'red']} value={80} />
4242
<Spacing />
43-
<Progress type='line' color={['#FFD080', 'red']} />
43+
<Progress type='line' color={['red', '#FFD080',]} value={80} />
4444
</Card>
4545
<Card title="设置大小">
46-
<Progress type='circle' width={60} left='6.5%' />
46+
<Progress type='circle' width={60} left='6.5%' value={10} />
4747
<Spacing />
48-
<Progress type='circle' width={80} left='8.5%' />
48+
<Progress type='circle' width={80} left='8.5%' value={20} />
4949
<Spacing />
50-
<Progress type='line' width={60} />
50+
<Progress type='line' width={60} value={40} />
5151
<Spacing />
52-
<Progress type='line' width={80} />
52+
<Progress type='line' width={80} value={60} />
5353
</Card>
5454
<Card title="是否显示单位">
55-
<Progress type='circle' showUnit={false} left='12.5%' />
55+
<Progress type='circle' showUnit={false} left='13%' value={20} />
5656
<Spacing />
57-
<Progress type='line' showUnit={false} />
57+
<Progress type='line' showUnit={false} value={40} />
5858
</Card>
5959
<Card title="自定义单色">
60-
<Progress type='circle' color='#FFD080' />
60+
<Progress type='circle' color='#FFD080' value={50} />
6161
<Spacing />
62-
<Progress type='line' color='#FFD080' />
62+
<Progress type='line' color='#FFD080' value={60} />
6363
</Card>
6464
<Card title="自定义背景色">
6565
<Progress type='circle' bgColor="#FFD080" value={5} />

test-ci/src/__tests__/progress.tsx

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,29 +5,12 @@
55
import 'react-native';
66
import React from 'react';
77
import Progress from '../lib/Progress';
8-
// Note: test renderer must be required after react-native.
98
import renderer from 'react-test-renderer';
10-
import { run } from '../lib/Progress/svg';
119

1210
it('Progress', () => {
1311
const component = renderer.create(
14-
<Progress
15-
progress={30}
16-
position="fixed"
17-
progressColor="#108ee9"
18-
animation={{ duration: 1000 }}
19-
xml={run}
20-
iconShow={true}
21-
size={25}
22-
progressShow={true}
23-
/>,
12+
<Progress type='line' value={60} />,
2413
);
25-
expect(component.root.props.progress).toBe(30);
26-
expect(component.root.props.position).toBe('fixed');
27-
expect(component.root.props.progressColor).toBe('#108ee9');
28-
expect(component.root.props.animation.duration).toBe(1000);
29-
expect(component.root.props.iconShow).toBeTruthy();
30-
expect(component.root.props.xml).toStrictEqual(run);
31-
expect(component.root.props.size).toBe(25);
32-
expect(component.root.props.progressShow).toBeTruthy();
14+
expect(component.root.props.type).toBe('line');
15+
expect(component.root.props.value).toBe(60);
3316
});

0 commit comments

Comments
 (0)