diff --git a/components/input-number/__tests__/index.test.tsx b/components/input-number/__tests__/index.test.tsx
index f6494c21cd..5e51036ac1 100644
--- a/components/input-number/__tests__/index.test.tsx
+++ b/components/input-number/__tests__/index.test.tsx
@@ -98,12 +98,18 @@ describe('InputNumber', () => {
).toBe(true);
});
- it('deprecate bordered', () => {
+ it('Deprecation and usage tips', () => {
const errorSpy = jest.spyOn(console, 'error').mockImplementation(() => {});
- const { container } = render();
- expect(errorSpy).toHaveBeenCalledWith(
+ const { container } = render();
+ expect(errorSpy).toHaveBeenNthCalledWith(
+ 1,
'Warning: [antd: InputNumber] `bordered` is deprecated. Please use `variant` instead.',
);
+ expect(errorSpy).toHaveBeenNthCalledWith(
+ 2,
+ 'Warning: [antd: InputNumber] When `type=number` is used together with `changeOnWheel`, changeOnWheel may not work properly. Please delete `type=number` if it is not necessary.',
+ );
+
expect(container.querySelector('.ant-input-number-borderless')).toBeTruthy();
errorSpy.mockRestore();
});
diff --git a/components/input-number/index.tsx b/components/input-number/index.tsx
index 9733bda5c1..a6407222d7 100644
--- a/components/input-number/index.tsx
+++ b/components/input-number/index.tsx
@@ -42,8 +42,13 @@ export interface InputNumberProps
const InputNumber = React.forwardRef((props, ref) => {
if (process.env.NODE_ENV !== 'production') {
- const { deprecated } = devUseWarning('InputNumber');
- deprecated(!('bordered' in props), 'bordered', 'variant');
+ const typeWarning = devUseWarning('InputNumber');
+ typeWarning.deprecated(!('bordered' in props), 'bordered', 'variant');
+ typeWarning(
+ !(props.type === 'number' && props.changeOnWheel),
+ 'usage',
+ 'When `type=number` is used together with `changeOnWheel`, changeOnWheel may not work properly. Please delete `type=number` if it is not necessary.',
+ );
}
const { getPrefixCls, direction } = React.useContext(ConfigContext);