File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -232,7 +232,7 @@ function calculateNewValue(
232232
233233 const reachedMin = value === node . min
234234 if ( inputData === 'ArrowDown' && ! reachedMin ) {
235- newValue = ( Number ( value ) - 1 ) . toString ( )
235+ newValue = ( Number ( value ) - step ) . toString ( )
236236 }
237237 }
238238
Original file line number Diff line number Diff line change @@ -443,3 +443,15 @@ test("increments number input's value by the defined steps when pressing the arr
443443
444444 expect ( element ) . toHaveValue ( 20 )
445445} )
446+
447+ test ( "decrements number input's value by the defined steps when pressing the arrow down key" , ( ) => {
448+ const { element} = render < HTMLInputElement > (
449+ `<input value="10" type="number" step="10"/>` ,
450+ )
451+
452+ const instance = setupInstance ( )
453+
454+ instance . dispatchUIEvent ( element , 'keydown' , { key : 'ArrowDown' } )
455+
456+ expect ( element ) . toHaveValue ( 0 )
457+ } )
You can’t perform that action at this time.
0 commit comments