File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -225,8 +225,9 @@ function calculateNewValue(
225
225
inputType === 'changeNumberInput'
226
226
) {
227
227
const reachedMax = value === node . max
228
+ const step = node . step ? Number ( node . step ) : 1
228
229
if ( inputData === 'ArrowUp' && ! reachedMax ) {
229
- newValue = ( Number ( value ) + 1 ) . toString ( )
230
+ newValue = ( Number ( value ) + step ) . toString ( )
230
231
}
231
232
232
233
const reachedMin = value === node . min
Original file line number Diff line number Diff line change @@ -431,3 +431,15 @@ test("do not decrement number input's value when pressing the arrow down key and
431
431
432
432
expect ( element ) . toHaveValue ( 1 )
433
433
} )
434
+
435
+ test ( "increments number input's value by the defined steps when pressing the arrow up key" , ( ) => {
436
+ const { element} = render < HTMLInputElement > (
437
+ `<input value="10" type="number" step="10"/>` ,
438
+ )
439
+
440
+ const instance = setupInstance ( )
441
+
442
+ instance . dispatchUIEvent ( element , 'keydown' , { key : 'ArrowUp' } )
443
+
444
+ expect ( element ) . toHaveValue ( 20 )
445
+ } )
You can’t perform that action at this time.
0 commit comments