mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-03 04:30:06 +08:00
🐛 fix progress success UI when status is invalid
This commit is contained in:
parent
463ac0eccb
commit
fbcc884b5b
@ -94,7 +94,15 @@ describe('Progress', () => {
|
||||
|
||||
// https://github.com/ant-design/ant-design/issues/15950
|
||||
it('should show success status when percent is 100 and status is undefined', () => {
|
||||
const wrapper2 = mount(<Progress percent={100} status={undefined} />);
|
||||
expect(wrapper2.find('.ant-progress-status-success')).toHaveLength(1);
|
||||
const wrapper = mount(<Progress percent={100} status={undefined} />);
|
||||
expect(wrapper.find('.ant-progress-status-success')).toHaveLength(1);
|
||||
});
|
||||
|
||||
// https://github.com/ant-design/ant-design/pull/15951#discussion_r273062969
|
||||
it('should show success status when status is invalid', () => {
|
||||
const errorSpy = jest.spyOn(console, 'error').mockImplementation(() => {});
|
||||
const wrapper = mount(<Progress percent={100} status="invalid" />);
|
||||
expect(wrapper.find('.ant-progress-status-success')).toHaveLength(1);
|
||||
errorSpy.mockRestore();
|
||||
});
|
||||
});
|
||||
|
@ -67,7 +67,7 @@ export default class Progress extends React.Component<ProgressProps> {
|
||||
successPercent !== undefined ? successPercent.toString() : percent.toString(),
|
||||
10,
|
||||
);
|
||||
if (percentNumber >= 100 && status === undefined) {
|
||||
if (percentNumber >= 100 && ProgressStatuses.indexOf(status!) < 0) {
|
||||
return 'success';
|
||||
}
|
||||
return status || 'normal';
|
||||
|
Loading…
Reference in New Issue
Block a user