fix: typo in console.error

pull/17505/head
Michael Salaverry 6 years ago
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(() => {});
render(<Icon type="interation" />);
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" />);
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" />);
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" />);
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);
errorSpy.mockRestore();

@ -72,7 +72,7 @@ export function alias(type: string) {
warning(
newType === type,
'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;
}

Loading…
Cancel
Save