@@ -215,7 +215,7 @@ describe('timepicker directive', function () {
215
215
expect ( getModelState ( ) ) . toEqual ( [ 23 , 0 ] ) ;
216
216
} ) ;
217
217
218
- it ( 'changes only the time part' , function ( ) {
218
+ it ( 'changes only the time part when hours change ' , function ( ) {
219
219
$rootScope . time = newTime ( 23 , 50 ) ;
220
220
$rootScope . $digest ( ) ;
221
221
@@ -228,6 +228,30 @@ describe('timepicker directive', function () {
228
228
expect ( date ) . toEqual ( $rootScope . time . getDate ( ) ) ;
229
229
} ) ;
230
230
231
+ it ( 'changes only the time part when minutes change' , function ( ) {
232
+ element = $compile ( '<timepicker ng-model="time" minute-step="15"></timepicker>' ) ( $rootScope ) ;
233
+ $rootScope . time = newTime ( 0 , 0 ) ;
234
+ $rootScope . $digest ( ) ;
235
+
236
+ var date = $rootScope . time . getDate ( ) ;
237
+ var up = getMinutesButton ( true ) ;
238
+ doClick ( up , 2 ) ;
239
+ expect ( getTimeState ( ) ) . toEqual ( [ '12' , '30' , 'AM' ] ) ;
240
+ expect ( getModelState ( ) ) . toEqual ( [ 0 , 30 ] ) ;
241
+ expect ( date ) . toEqual ( $rootScope . time . getDate ( ) ) ;
242
+
243
+ var down = getMinutesButton ( false ) ;
244
+ doClick ( down , 2 ) ;
245
+ expect ( getTimeState ( ) ) . toEqual ( [ '12' , '00' , 'AM' ] ) ;
246
+ expect ( getModelState ( ) ) . toEqual ( [ 0 , 0 ] ) ;
247
+ expect ( date ) . toEqual ( $rootScope . time . getDate ( ) ) ;
248
+
249
+ doClick ( down , 2 ) ;
250
+ expect ( getTimeState ( ) ) . toEqual ( [ '11' , '30' , 'PM' ] ) ;
251
+ expect ( getModelState ( ) ) . toEqual ( [ 23 , 30 ] ) ;
252
+ expect ( date ) . toEqual ( $rootScope . time . getDate ( ) ) ;
253
+ } ) ;
254
+
231
255
it ( 'responds properly on "mousewheel" events' , function ( ) {
232
256
var inputs = element . find ( 'input' ) ;
233
257
var hoursEl = inputs . eq ( 0 ) , minutesEl = inputs . eq ( 1 ) ;
0 commit comments