@@ -215,7 +215,7 @@ describe('timepicker directive', function () {
215215 expect ( getModelState ( ) ) . toEqual ( [ 23 , 0 ] ) ;
216216 } ) ;
217217
218- it ( 'changes only the time part' , function ( ) {
218+ it ( 'changes only the time part when hours change ' , function ( ) {
219219 $rootScope . time = newTime ( 23 , 50 ) ;
220220 $rootScope . $digest ( ) ;
221221
@@ -228,6 +228,30 @@ describe('timepicker directive', function () {
228228 expect ( date ) . toEqual ( $rootScope . time . getDate ( ) ) ;
229229 } ) ;
230230
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+
231255 it ( 'responds properly on "mousewheel" events' , function ( ) {
232256 var inputs = element . find ( 'input' ) ;
233257 var hoursEl = inputs . eq ( 0 ) , minutesEl = inputs . eq ( 1 ) ;
0 commit comments