From 1d72ddf6bceec8d36522b4adaf2045bad6e99f1f Mon Sep 17 00:00:00 2001 From: tangjinzhou <415800467@qq.com> Date: Mon, 10 Dec 2018 22:25:16 +0800 Subject: [PATCH] feat: update progress & radio --- .../date-picker/__tests__/DatePicker.test.js | 4 +- .../__tests__/__snapshots__/demo.test.js.snap | 69 ++++++++++--------- .../__snapshots__/index.test.js.snap | 14 ++-- components/progress/progress.jsx | 13 +++- components/radio/RadioButton.jsx | 6 +- components/radio/demo/index.vue | 4 +- components/vc-progress/src/Circle.js | 11 +-- components/vc-progress/src/Line.js | 1 + 8 files changed, 62 insertions(+), 60 deletions(-) diff --git a/components/date-picker/__tests__/DatePicker.test.js b/components/date-picker/__tests__/DatePicker.test.js index a68be1477..a9f10a445 100644 --- a/components/date-picker/__tests__/DatePicker.test.js +++ b/components/date-picker/__tests__/DatePicker.test.js @@ -177,10 +177,10 @@ describe('DatePicker', () => { }, 0) await asyncExpect(() => { selectDateFromBody(moment('2016-11-23')) - }, 0) + }, 100) await asyncExpect(() => { clearInput(wrapper) - }, 300) + }, 1000) await asyncExpect(() => { openPanel(wrapper) }, 0) diff --git a/components/progress/__tests__/__snapshots__/demo.test.js.snap b/components/progress/__tests__/__snapshots__/demo.test.js.snap index 8d27400bd..98abfcdda 100644 --- a/components/progress/__tests__/__snapshots__/demo.test.js.snap +++ b/components/progress/__tests__/__snapshots__/demo.test.js.snap @@ -6,27 +6,27 @@ exports[`renders ./components/progress/demo/circle.md correctly 1`] = `
+ a 47,47 0 1 1 0,-94" stroke="#f3f3f3" stroke-width="6" fill-opacity="0" class="ant-progress-circle-trail" style="stroke-dasharray: 295.3097094374406px 295.3097094374406px; stroke-dashoffset: -0px;"> - 75%
+ 75%
+ a 47,47 0 1 1 0,-94" stroke="#f3f3f3" stroke-width="6" fill-opacity="0" class="ant-progress-circle-trail" style="stroke-dasharray: 295.3097094374406px 295.3097094374406px; stroke-dashoffset: -0px;"> -
+
+ a 47,47 0 1 1 0,-94" stroke="#f3f3f3" stroke-width="6" fill-opacity="0" class="ant-progress-circle-trail" style="stroke-dasharray: 295.3097094374406px 295.3097094374406px; stroke-dashoffset: -0px;"> @@ -41,8 +41,11 @@ exports[`renders ./components/progress/demo/circle-dynamic.md correctly 1`] = `
- 0%
+ a 47,47 0 1 1 0,-94" stroke="#f3f3f3" stroke-width="6" fill-opacity="0" class="ant-progress-circle-trail" style="stroke-dasharray: 295.3097094374406px 295.3097094374406px; stroke-dashoffset: -0px;"> + + 0%
+ a 47,47 0 1 1 0,-94" stroke="#f3f3f3" stroke-width="6" fill-opacity="0" class="ant-progress-circle-trail" style="stroke-dasharray: 295.3097094374406px 295.3097094374406px; stroke-dashoffset: -0px;"> -
+
+ a 47,47 0 1 1 0,-94" stroke="#f3f3f3" stroke-width="6" fill-opacity="0" class="ant-progress-circle-trail" style="stroke-dasharray: 295.3097094374406px 295.3097094374406px; stroke-dashoffset: -0px;"> @@ -93,11 +96,11 @@ exports[`renders ./components/progress/demo/dashboard.md correctly 1`] = `
+ a 47,47 0 1 1 0,94" stroke="#f3f3f3" stroke-width="6" fill-opacity="0" class="ant-progress-circle-trail" style="stroke-dasharray: 220.30970943744057px 295.3097094374406px; stroke-dashoffset: -37.5px;"> - 75%
+ 75%
`; @@ -110,7 +113,7 @@ exports[`renders ./components/progress/demo/dynamic.md correctly 1`] = `
- 0% + 0%
+ a 47,47 0 1 1 0,-94" stroke="#f3f3f3" stroke-width="6" fill-opacity="0" class="ant-progress-circle-trail" style="stroke-dasharray: 295.3097094374406px 295.3097094374406px; stroke-dashoffset: -0px;"> - Done
+ Done
`; @@ -154,7 +157,7 @@ exports[`renders ./components/progress/demo/line.md correctly 1`] = `
- 30% + 30%
@@ -163,7 +166,7 @@ exports[`renders ./components/progress/demo/line.md correctly 1`] = `
-
50% + 50%
@@ -172,7 +175,7 @@ exports[`renders ./components/progress/demo/line.md correctly 1`] = `
-
+
@@ -181,7 +184,7 @@ exports[`renders ./components/progress/demo/line.md correctly 1`] = `
-
+
@@ -204,7 +207,7 @@ exports[`renders ./components/progress/demo/line-mini.md correctly 1`] = `
-
30% + 30%
@@ -213,7 +216,7 @@ exports[`renders ./components/progress/demo/line-mini.md correctly 1`] = `
-
50% + 50%
@@ -222,7 +225,7 @@ exports[`renders ./components/progress/demo/line-mini.md correctly 1`] = `
-
+
@@ -231,7 +234,7 @@ exports[`renders ./components/progress/demo/line-mini.md correctly 1`] = `
-
+ @@ -245,28 +248,28 @@ exports[`renders ./components/progress/demo/linecap.md correctly 1`] = `
- 75% + 75%
+ a 47,47 0 1 1 0,-94" stroke="#f3f3f3" stroke-width="6" fill-opacity="0" class="ant-progress-circle-trail" style="stroke-dasharray: 295.3097094374406px 295.3097094374406px; stroke-dashoffset: -0px;"> - 75%
+ 75%
+ a 47,47 0 1 1 0,94" stroke="#f3f3f3" stroke-width="6" fill-opacity="0" class="ant-progress-circle-trail" style="stroke-dasharray: 220.30970943744057px 295.3097094374406px; stroke-dashoffset: -37.5px;"> - 75%
+ 75%
`; @@ -279,7 +282,7 @@ exports[`renders ./components/progress/demo/segment.md correctly 1`] = `
- 60% + 60% `; diff --git a/components/progress/__tests__/__snapshots__/index.test.js.snap b/components/progress/__tests__/__snapshots__/index.test.js.snap index e18eae092..6a0523a9d 100644 --- a/components/progress/__tests__/__snapshots__/index.test.js.snap +++ b/components/progress/__tests__/__snapshots__/index.test.js.snap @@ -5,11 +5,11 @@ exports[`Progress render format 1`] = `
+ a 47,47 0 1 1 0,-94" stroke="#f3f3f3" stroke-width="6" fill-opacity="0" class="ant-progress-circle-trail" style="stroke-dasharray: 295.3097094374406px 295.3097094374406px; stroke-dashoffset: -0px;"> - 50%
+ 50% `; @@ -20,7 +20,7 @@ exports[`Progress render negetive progress 1`] = `
- 0% + 0% `; @@ -33,7 +33,7 @@ exports[`Progress render negetive successPercent 1`] = `
- 50% + 50% `; @@ -46,7 +46,7 @@ exports[`Progress render negetive successPercent 2`] = `
- 50 10 + 50 10 `; @@ -58,7 +58,7 @@ exports[`Progress render out-of-range progress 1`] = `
- + `; @@ -70,7 +70,7 @@ exports[`Progress render out-of-range progress with info 1`] = `
- + `; diff --git a/components/progress/progress.jsx b/components/progress/progress.jsx index ad7ea0dde..de501fcaa 100644 --- a/components/progress/progress.jsx +++ b/components/progress/progress.jsx @@ -74,11 +74,18 @@ export default { if (format || (progressStatus !== 'exception' && progressStatus !== 'success')) { text = textFormatter(validProgress(percent), validProgress(successPercent)) } else if (progressStatus === 'exception') { - text = + text = } else if (progressStatus === 'success') { - text = + text = } - progressInfo = {text} + progressInfo = ( + + {text} + + ) } if (type === 'line') { diff --git a/components/radio/RadioButton.jsx b/components/radio/RadioButton.jsx index de7785fcb..c99938544 100644 --- a/components/radio/RadioButton.jsx +++ b/components/radio/RadioButton.jsx @@ -22,10 +22,6 @@ export default { radioProps.props.checked = props.value === this.radioGroupContext.stateValue radioProps.props.disabled = props.disabled || this.radioGroupContext.disabled } - return ( - - {this.$slots.default} - - ) + return {this.$slots.default} }, } diff --git a/components/radio/demo/index.vue b/components/radio/demo/index.vue index 718db6cc9..ae7284916 100644 --- a/components/radio/demo/index.vue +++ b/components/radio/demo/index.vue @@ -26,8 +26,8 @@ const md = { ## When To Use -- Used to select a single state in multiple options. -- The difference between Select is that Radio is visible to user and can facilitate the comparison of choice, which makes there shouldn't be too many of them. +- Used to select a single state from multiple options. +- The difference from Select is that Radio is visible to the user and can facilitate the comparison of choice, which means there shouldn't be too many of them. ## Examples `, } diff --git a/components/vc-progress/src/Circle.js b/components/vc-progress/src/Circle.js index 149c0e5cc..41e0f776e 100644 --- a/components/vc-progress/src/Circle.js +++ b/components/vc-progress/src/Circle.js @@ -48,7 +48,6 @@ const Circle = { a ${radius},${radius} 0 1 1 ${-endPositionX},${endPositionY}` const len = Math.PI * 2 * radius const trailPathStyle = { - stroke: strokeColor, strokeDasharray: `${len - gapDegree}px ${len}px`, strokeDashoffset: `-${gapDegree / 2}px`, transition: 'stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s', @@ -102,13 +101,9 @@ const Circle = { - { - percent > 0 ? ( - - ) : null - } + ) }, diff --git a/components/vc-progress/src/Line.js b/components/vc-progress/src/Line.js index 3beff0df0..cf4631890 100644 --- a/components/vc-progress/src/Line.js +++ b/components/vc-progress/src/Line.js @@ -30,6 +30,7 @@ const Line = { `M ${strokeLinecap === 'round' ? center : 0},${center} L ${strokeLinecap === 'round' ? right : 100},${center}` const viewBoxString = `0 0 100 ${strokeWidth}` + const pathFirst = { attrs: { 'd': pathString,