diff --git a/src/CircularProgressbar.tsx b/src/CircularProgressbar.tsx index 73147cd..93fd46d 100644 --- a/src/CircularProgressbar.tsx +++ b/src/CircularProgressbar.tsx @@ -71,7 +71,8 @@ class CircularProgressbar extends React.Component { } = this.props; const pathRadius = this.getPathRadius(); - const pathRatio = value / (maxValue - minValue); + const boundedValue = Math.min(Math.max(value, minValue), maxValue); + const pathRatio = boundedValue / (maxValue - minValue); return ( ', () => { expect(wrapper.find('.CircularProgressbar-text').text()).toEqual('50%'); }); }); - describe('props.percentage', () => { + describe('props.value', () => { test('Renders correct path', () => { const percentage = 30; const wrapper = mount(