mirror of
https://github.com/ant-design/ant-design.git
synced 2025-01-19 06:43:16 +08:00
fix showInfo when precent is out of range
This commit is contained in:
parent
0eb835772d
commit
2604623b7e
@ -20,7 +20,7 @@ exports[`Progress render negetive progress 1`] = `
|
||||
<span
|
||||
class="ant-progress-text"
|
||||
>
|
||||
-20%
|
||||
0%
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@ -83,3 +83,31 @@ exports[`Progress render out-of-range progress 1`] = `
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`Progress render out-of-range progress with info 1`] = `
|
||||
<div
|
||||
class="ant-progress ant-progress-line ant-progress-status-success ant-progress-show-info ant-progress-default"
|
||||
>
|
||||
<div>
|
||||
<div
|
||||
class="ant-progress-outer"
|
||||
>
|
||||
<div
|
||||
class="ant-progress-inner"
|
||||
>
|
||||
<div
|
||||
class="ant-progress-bg"
|
||||
style="width: 100%; height: 8px;"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<span
|
||||
class="ant-progress-text"
|
||||
>
|
||||
<i
|
||||
class="anticon anticon-check-circle"
|
||||
/>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
|
@ -16,6 +16,11 @@ describe('Progress', () => {
|
||||
expect(wrapper.render()).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('render out-of-range progress with info', async () => {
|
||||
const wrapper = mount(<Progress percent={120} showInfo />);
|
||||
expect(wrapper.render()).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('render negetive progress', async () => {
|
||||
const wrapper = mount(<Progress percent={-20} />);
|
||||
expect(wrapper.render()).toMatchSnapshot();
|
||||
|
@ -82,11 +82,11 @@ export default class Progress extends React.Component<ProgressProps, {}> {
|
||||
let text;
|
||||
const iconType = (type === 'circle' || type === 'dashboard') ? '' : '-circle';
|
||||
if (progressStatus === 'exception') {
|
||||
text = format ? textFormatter(percent) : <Icon type={`cross${iconType}`} />;
|
||||
text = format ? textFormatter(validProgress(percent)) : <Icon type={`cross${iconType}`} />;
|
||||
} else if (progressStatus === 'success') {
|
||||
text = format ? textFormatter(percent) : <Icon type={`check${iconType}`} />;
|
||||
text = format ? textFormatter(validProgress(percent)) : <Icon type={`check${iconType}`} />;
|
||||
} else {
|
||||
text = textFormatter(percent);
|
||||
text = textFormatter(validProgress(percent));
|
||||
}
|
||||
progressInfo = <span className={`${prefixCls}-text`}>{text}</span>;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user