File tree 2 files changed +26
-2
lines changed
2 files changed +26
-2
lines changed Original file line number Diff line number Diff line change @@ -502,8 +502,10 @@ class StepInput extends UI5Element {
502
502
}
503
503
504
504
_fireChangeEvent ( ) {
505
- this . _previousValue = this . value ;
506
- this . fireEvent ( "change" , { value : this . value } ) ;
505
+ if ( this . _previousValue !== this . value ) {
506
+ this . _previousValue = this . value ;
507
+ this . fireEvent ( "change" , { value : this . value } ) ;
508
+ }
507
509
}
508
510
509
511
/**
@@ -553,6 +555,9 @@ class StepInput extends UI5Element {
553
555
}
554
556
555
557
_onInputChange ( event ) {
558
+ if ( this . input . value === "" ) {
559
+ this . input . value = this . min || 0 ;
560
+ }
556
561
const inputValue = this . _preciseValue ( parseFloat ( this . input . value ) ) ;
557
562
if ( this . value !== this . _previousValue || this . value !== inputValue ) {
558
563
this . value = inputValue ;
Original file line number Diff line number Diff line change @@ -424,6 +424,25 @@ describe("'change' event firing", () => {
424
424
assert . strictEqual ( Number ( changeResult . getProperty ( "value" ) ) , 2 , "'change' event is fired 2 times" ) ;
425
425
} ) ;
426
426
427
+ it ( "'change' event should be fired once after element deleted and focus out" , ( ) => {
428
+ browser . url ( `http://localhost:${ PORT } /test-resources/pages/StepInput.html` ) ;
429
+ const siCozy = $ ( "#stepInputCozy" ) ;
430
+ const siMinMax = $ ( "#stepInputMinMax" ) ;
431
+ const changeResult = $ ( "#changeResult" ) ;
432
+
433
+ siMinMax . click ( ) ;
434
+ siMinMax . keys ( "ArrowUp" ) ;
435
+ siMinMax . keys ( "ArrowUp" ) ;
436
+ siMinMax . keys ( "ArrowUp" ) ;
437
+ siCozy . click ( ) ;
438
+ assert . strictEqual ( siMinMax . getProperty ( "value" ) , 3 , "Value is increased correctly to 3" ) ;
439
+ assert . strictEqual ( Number ( changeResult . getProperty ( "value" ) ) , 1 , "'change' event is fired 1 time" ) ;
440
+ siMinMax . doubleClick ( ) ;
441
+ siMinMax . keys ( "Backspace" ) ;
442
+ siCozy . click ( ) ;
443
+ assert . strictEqual ( siMinMax . getProperty ( "value" ) , 0 , "Value is increased correctly to 1" ) ;
444
+ assert . strictEqual ( Number ( changeResult . getProperty ( "value" ) ) , 2 , "'change' event is fired 2 times" ) ;
445
+ } ) ;
427
446
} ) ;
428
447
429
448
describe ( "Accessibility related parameters" , ( ) => {
You can’t perform that action at this time.
0 commit comments