mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-02 12:09:14 +08:00
fix(Progress): prevent warning when size prop is not set for circle p… (#41875)
* fix(Progress): prevent warning when size prop is not set for circle progress * fix(Progress): add test case for #41875 --------- Co-authored-by: lijianan <574980606@qq.com>
This commit is contained in:
parent
8200e5ccb3
commit
f3be5ddd0e
@ -28,12 +28,10 @@ const Circle: React.FC<CircleProps> = (props) => {
|
||||
type,
|
||||
children,
|
||||
success,
|
||||
size,
|
||||
size = originWidth,
|
||||
} = props;
|
||||
|
||||
const mergedSize = size ?? [originWidth, originWidth];
|
||||
|
||||
const [width, height] = getSize(mergedSize, 'circle');
|
||||
const [width, height] = getSize(size, 'circle');
|
||||
|
||||
let { strokeWidth } = props;
|
||||
if (strokeWidth === undefined) {
|
||||
|
@ -264,6 +264,13 @@ describe('Progress', () => {
|
||||
);
|
||||
});
|
||||
|
||||
it('should not warning if not pass the `size` prop in type Circle', () => {
|
||||
const errorSpy = jest.spyOn(console, 'error').mockImplementation(() => {});
|
||||
errorSpy.mockClear();
|
||||
render(<Progress type="circle" />);
|
||||
expect(errorSpy).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should warnning if pass number[] into `size` in type dashboard', () => {
|
||||
const errorSpy = jest.spyOn(console, 'error').mockImplementation(() => {});
|
||||
render(<Progress size={[60, 20]} type="dashboard" />);
|
||||
|
Loading…
Reference in New Issue
Block a user