diff --git a/src/Circle/index.tsx b/src/Circle/index.tsx index cde8157..7a06b32 100644 --- a/src/Circle/index.tsx +++ b/src/Circle/index.tsx @@ -187,7 +187,7 @@ const Circle: React.FC = (props) => { cy={halfSize} stroke={railColor} strokeLinecap={mergedStrokeLinecap} - strokeWidth={railWidth || strokeWidth} + strokeWidth={railWidth ?? strokeWidth} style={{ ...circleStyle, ...styles.rail }} /> )} diff --git a/src/Line.tsx b/src/Line.tsx index cfb8c17..d2b1e46 100644 --- a/src/Line.tsx +++ b/src/Line.tsx @@ -63,7 +63,7 @@ const Line: React.FC = (props) => { d={pathString} strokeLinecap={strokeLinecap} stroke={railColor} - strokeWidth={railWidth || strokeWidth} + strokeWidth={railWidth ?? strokeWidth} fillOpacity="0" /> {percentList.map((ptg, index) => { diff --git a/tests/index.spec.js b/tests/index.spec.js index 294f352..6b9ddc2 100644 --- a/tests/index.spec.js +++ b/tests/index.spec.js @@ -39,6 +39,21 @@ describe('Progress', () => { }); }); + it('should support zero rail width', () => { + const { container } = render( +
+ + +
, + ); + + expect(container.querySelector('.rc-progress-line-rail')).toHaveAttribute('stroke-width', '0'); + expect(container.querySelector('.rc-progress-circle-rail')).toHaveAttribute( + 'stroke-width', + '0', + ); + }); + describe('Circle', () => { it('change with animation', () => { function Demo() {