diff --git a/components/progress/__tests__/__snapshots__/index.test.js.snap b/components/progress/__tests__/__snapshots__/index.test.js.snap index 771f020bff..0959db3cfa 100644 --- a/components/progress/__tests__/__snapshots__/index.test.js.snap +++ b/components/progress/__tests__/__snapshots__/index.test.js.snap @@ -20,7 +20,7 @@ exports[`Progress render negetive progress 1`] = ` - -20% + 0% @@ -83,3 +83,31 @@ exports[`Progress render out-of-range progress 1`] = ` `; + +exports[`Progress render out-of-range progress with info 1`] = ` +
+
+
+
+
+
+
+ + + +
+
+`; diff --git a/components/progress/__tests__/index.test.js b/components/progress/__tests__/index.test.js index 5c82028bc3..189a4d63f8 100644 --- a/components/progress/__tests__/index.test.js +++ b/components/progress/__tests__/index.test.js @@ -16,6 +16,11 @@ describe('Progress', () => { expect(wrapper.render()).toMatchSnapshot(); }); + it('render out-of-range progress with info', async () => { + const wrapper = mount(); + expect(wrapper.render()).toMatchSnapshot(); + }); + it('render negetive progress', async () => { const wrapper = mount(); expect(wrapper.render()).toMatchSnapshot(); diff --git a/components/progress/progress.tsx b/components/progress/progress.tsx index 998416ac67..9ce5e81278 100644 --- a/components/progress/progress.tsx +++ b/components/progress/progress.tsx @@ -82,11 +82,11 @@ export default class Progress extends React.Component { let text; const iconType = (type === 'circle' || type === 'dashboard') ? '' : '-circle'; if (progressStatus === 'exception') { - text = format ? textFormatter(percent) : ; + text = format ? textFormatter(validProgress(percent)) : ; } else if (progressStatus === 'success') { - text = format ? textFormatter(percent) : ; + text = format ? textFormatter(validProgress(percent)) : ; } else { - text = textFormatter(percent); + text = textFormatter(validProgress(percent)); } progressInfo = {text}; }