@@ -102,6 +102,35 @@ describe("DateTimePicker general interaction", () => {
102
102
assert . strictEqual ( newValue . toUpperCase ( ) , "14/04/2020, 01:02:03 AM" , "The new date/time is correctly selected." ) ;
103
103
} ) ;
104
104
105
+ it ( "tests selection of new date without changing the time section" , ( ) => {
106
+ const PREVIOUS_VALUE = "14/04/2020, 01:02:03 AM" ;
107
+ const dtPicker = browser . $ ( "#dtSeconds" ) ;
108
+ // assert
109
+ const currentValue = dtPicker . shadow$ ( "ui5-input" ) . getValue ( ) ;
110
+ assert . strictEqual ( currentValue , PREVIOUS_VALUE , "The initial date/time is correctly set." ) ;
111
+
112
+ browser . keys ( "Tab" ) ;
113
+ browser . keys ( [ "Shift" , "Tab" ] ) ;
114
+ browser . keys ( "Backspace" ) ;
115
+ browser . keys ( "wrongtext" ) ;
116
+ browser . keys ( "Tab" ) ;
117
+
118
+ openPickerById ( "dtSeconds" ) ;
119
+ // act
120
+ const picker = getPicker ( "dtSeconds" ) ;
121
+ // select the next day (the right from the selected)
122
+ const selectedDay = picker . $ ( "ui5-calendar" ) . shadow$ ( "ui5-daypicker" ) . shadow$ ( ".ui5-dp-item--now" ) ;
123
+ const timestamp = selectedDay . getAttribute ( "data-sap-timestamp" ) ;
124
+ const date = new Date ( timestamp * 1000 ) ;
125
+ const selectedDate = `${ date . getDate ( ) < 10 ? "0" : "" } ${ date . getDate ( ) } /${ date . getMonth ( ) + 1 < 10 ? "0" : "" } ${ date . getMonth ( ) + 1 } /${ date . getFullYear ( ) } ` ;
126
+ selectedDay . click ( ) ;
127
+ picker . $ ( "#ok" ) . click ( ) ;
128
+ // assert
129
+ const newValue = dtPicker . shadow$ ( "ui5-input" ) . getValue ( ) ;
130
+ const result = newValue . indexOf ( selectedDate ) > - 1 ;
131
+ assert . ok ( result , "The new date/time is correctly selected." ) ;
132
+ } ) ;
133
+
105
134
it ( "tests change event is fired on submit" , ( ) => {
106
135
// test submit from empty value to current date/time value
107
136
openPickerById ( "dt1" ) ;
0 commit comments