@@ -239,13 +239,13 @@ describe('InputNumber.Github', () => {
239
239
240
240
wrapper . focusInput ( ) ;
241
241
wrapper . changeValue ( '123' ) ;
242
- expect ( onChange ) . toHaveBeenCalledTimes ( 1 ) ;
243
- expect ( onChange ) . toHaveBeenCalledWith ( 10 ) ;
242
+ expect ( onChange ) . toHaveBeenCalledTimes ( 0 ) ;
244
243
expect ( onInput ) . toHaveBeenCalledTimes ( 1 ) ;
245
244
expect ( onInput ) . toHaveBeenCalledWith ( '123' ) ;
246
245
247
246
wrapper . blurInput ( ) ;
248
247
expect ( onChange ) . toHaveBeenCalledTimes ( 1 ) ;
248
+ expect ( onChange ) . toHaveBeenCalledWith ( 10 ) ;
249
249
expect ( onInput ) . toHaveBeenCalledTimes ( 1 ) ;
250
250
251
251
// repeat it, it should works in same way
@@ -260,6 +260,33 @@ describe('InputNumber.Github', () => {
260
260
expect ( onInput ) . toHaveBeenCalledTimes ( 2 ) ;
261
261
} ) ;
262
262
263
+ // https://github.com/ant-design/ant-design/issues/30465
264
+ it ( 'not block user input with min & max' , ( ) => {
265
+ const onChange = jest . fn ( ) ;
266
+ const wrapper = mount ( < InputNumber min = { 1900 } onChange = { onChange } /> ) ;
267
+
268
+ wrapper . focusInput ( ) ;
269
+
270
+ wrapper . changeValue ( '2' ) ;
271
+ expect ( onChange ) . not . toHaveBeenCalled ( ) ;
272
+
273
+ wrapper . changeValue ( '20' ) ;
274
+ expect ( onChange ) . not . toHaveBeenCalled ( ) ;
275
+
276
+ wrapper . changeValue ( '200' ) ;
277
+ expect ( onChange ) . not . toHaveBeenCalled ( ) ;
278
+
279
+ wrapper . changeValue ( '2000' ) ;
280
+ expect ( onChange ) . toHaveBeenCalledWith ( 2000 ) ;
281
+ onChange . mockRestore ( ) ;
282
+
283
+ wrapper . changeValue ( '1' ) ;
284
+ expect ( onChange ) . not . toHaveBeenCalled ( ) ;
285
+
286
+ wrapper . blurInput ( ) ;
287
+ expect ( onChange ) . toHaveBeenCalledWith ( 1900 ) ;
288
+ } ) ;
289
+
263
290
// https://github.com/ant-design/ant-design/issues/7867
264
291
it ( 'focus should not cut precision of input value' , ( ) => {
265
292
const Demo = ( ) => {
0 commit comments