Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Circle/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ export const getCircleStyle = (
const positionDeg =
gapDegree === 0
? 0
: {
: ({
bottom: 0,
top: 180,
left: 90,
right: -90,
}[gapPosition];
}[gapPosition || 'bottom'] ?? 0);
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved

let strokeDashoffset = ((100 - percent) / 100) * perimeterWithoutGap;
// Fix percent accuracy when strokeLinecap is round
Expand Down
8 changes: 8 additions & 0 deletions tests/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -266,4 +266,12 @@ describe('Progress', () => {
expect(container.firstChild).toMatchSnapshot();
unmount();
});

it('Circle should not produce NaN transform when gapPosition is undefined with gapDegree', () => {
const { container } = render(<Circle percent={50} gapDegree={70} gapPosition={undefined} />);
const rail = container.querySelector('.rc-progress-circle-rail');
const path = container.querySelector('.rc-progress-circle-path');
expect(rail.style.transform).toBe('rotate(125deg)');
expect(path.style.transform).toBe('rotate(125deg)');
});
});