From 1057086df32a9b86c12f493fadeca187e2978655 Mon Sep 17 00:00:00 2001 From: yusongH <549962989@qq.com> Date: Wed, 23 Nov 2022 20:51:38 +0800 Subject: [PATCH] =?UTF-8?q?fix(progress):=20=E4=BF=AE=E5=A4=8Dpercentage?= =?UTF-8?q?=E5=80=BC=E4=B8=BA100=E6=97=B6,=E4=BC=9A=E5=BF=BD=E7=95=A5statu?= =?UTF-8?q?s=E8=AE=BE=E7=BD=AE=E7=9A=84=E5=80=BC=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../__snapshots__/index.test.jsx.snap | 136 ++++++++++++++++++ src/progress/__tests__/index.test.jsx | 11 ++ src/progress/progress.tsx | 2 +- 3 files changed, 148 insertions(+), 1 deletion(-) diff --git a/src/progress/__tests__/__snapshots__/index.test.jsx.snap b/src/progress/__tests__/__snapshots__/index.test.jsx.snap index ef4c33f38..c0e1a117d 100644 --- a/src/progress/__tests__/__snapshots__/index.test.jsx.snap +++ b/src/progress/__tests__/__snapshots__/index.test.jsx.snap @@ -373,6 +373,31 @@ exports[`Progress > :props > :status > :status is active 1`] = ` `; +exports[`Progress > :props > :status > :status is active and percentage is 100 1`] = ` +
+
+
+
+
+
+ 100% +
+
+
+`; + exports[`Progress > :props > :status > :status is error 1`] = `
:props > :status > :status is error 1`] = `
`; +exports[`Progress > :props > :status > :status is error and percentage is 100 1`] = ` +
+
+
+
+
+
+ + + +
+
+
+`; + exports[`Progress > :props > :status > :status is success 1`] = `
:props > :status > :status is success 1`] = `
`; +exports[`Progress > :props > :status > :status is success and percentage is 100 1`] = ` +
+
+
+
+
+
+ + + +
+
+
+`; + exports[`Progress > :props > :status > :status is warning 1`] = `
:props > :status > :status is warning 1`] = `
`; +exports[`Progress > :props > :status > :status is warning and percentage is 100 1`] = ` +
+
+
+
+
+
+ + + +
+
+
+`; + exports[`Progress > :props > :strokeWidth > :strokeWidth is Number, equal to 50 1`] = `
{ expect(wrapper.findComponent(Progress).vm.status).toBe(status); expect(wrapper.element).toMatchSnapshot(); }); + + it(`:status is ${status} and percentage is 100`, () => { + const wrapper = mount({ + render() { + return ; + }, + }); + expect(wrapper.findComponent(Progress).vm.percentage).toBe(100); + expect(wrapper.findComponent(Progress).vm.status).toBe(status); + expect(wrapper.element).toMatchSnapshot(); + }); }); }); diff --git a/src/progress/progress.tsx b/src/progress/progress.tsx index 41c2335f5..7b1a02407 100644 --- a/src/progress/progress.tsx +++ b/src/progress/progress.tsx @@ -27,7 +27,7 @@ export default mixins(classPrefixMixins, getGlobalIconMixins()).extend({ computed: { statusStyle(): string { - if (this.percentage >= 100) { + if (!this.status && this.percentage >= 100) { return 'success'; } return this.status;