mirror of
https://github.com/ant-design/ant-design.git
synced 2025-08-06 16:06:28 +08:00
fix: typo in console.error
This commit is contained in:
parent
bc6c0f1460
commit
76db651080
@ -227,23 +227,23 @@ describe('utils', () => {
|
|||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should depracate typo icon name', () => {
|
it('should report an error when there are deprecated typos in icon names', () => {
|
||||||
const errorSpy = jest.spyOn(console, 'error').mockImplementation(() => {});
|
const errorSpy = jest.spyOn(console, 'error').mockImplementation(() => {});
|
||||||
render(<Icon type="interation" />);
|
render(<Icon type="interation" />);
|
||||||
expect(errorSpy).toHaveBeenLastCalledWith(
|
expect(errorSpy).toHaveBeenLastCalledWith(
|
||||||
"Warning: [antd: Icon] Icon 'interation' is typo and depracated, please use 'interaction' instead.",
|
"Warning: [antd: Icon] Icon 'interation' was a typo and is now deprecated, please use 'interaction' instead.",
|
||||||
);
|
);
|
||||||
render(<Icon type="cross" />);
|
render(<Icon type="cross" />);
|
||||||
expect(errorSpy).toHaveBeenLastCalledWith(
|
expect(errorSpy).toHaveBeenLastCalledWith(
|
||||||
"Warning: [antd: Icon] Icon 'cross' is typo and depracated, please use 'close' instead.",
|
"Warning: [antd: Icon] Icon 'cross' was a typo and is now deprecated, please use 'close' instead.",
|
||||||
);
|
);
|
||||||
render(<Icon type="canlendar" theme="twoTone" />);
|
render(<Icon type="canlendar" theme="twoTone" />);
|
||||||
expect(errorSpy).toHaveBeenLastCalledWith(
|
expect(errorSpy).toHaveBeenLastCalledWith(
|
||||||
"Warning: [antd: Icon] Icon 'canlendar' is typo and depracated, please use 'calendar' instead.",
|
"Warning: [antd: Icon] Icon 'canlendar' was a typo and is now deprecated, please use 'calendar' instead.",
|
||||||
);
|
);
|
||||||
render(<Icon type="colum-height" />);
|
render(<Icon type="colum-height" />);
|
||||||
expect(errorSpy).toHaveBeenLastCalledWith(
|
expect(errorSpy).toHaveBeenLastCalledWith(
|
||||||
"Warning: [antd: Icon] Icon 'colum-height' is typo and depracated, please use 'column-height' instead.",
|
"Warning: [antd: Icon] Icon 'colum-height' was a typo and is now deprecated, please use 'column-height' instead.",
|
||||||
);
|
);
|
||||||
expect(errorSpy).toHaveBeenCalledTimes(4);
|
expect(errorSpy).toHaveBeenCalledTimes(4);
|
||||||
errorSpy.mockRestore();
|
errorSpy.mockRestore();
|
||||||
|
@ -72,7 +72,7 @@ export function alias(type: string) {
|
|||||||
warning(
|
warning(
|
||||||
newType === type,
|
newType === type,
|
||||||
'Icon',
|
'Icon',
|
||||||
`Icon '${type}' is typo and depracated, please use '${newType}' instead.`,
|
`Icon '${type}' was a typo and is now deprecated, please use '${newType}' instead.`,
|
||||||
);
|
);
|
||||||
return newType;
|
return newType;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user