@@ -15,9 +15,10 @@ import { IgxToggleDirective } from '../directives/toggle/toggle.directive';
15
15
import { PlatformUtil } from '../core/utils' ;
16
16
import { DatePart , IgxDateTimeEditorDirective } from '../directives/date-time-editor/public_api' ;
17
17
import { DateTimeUtil } from '../date-common/util/date-time.util' ;
18
- import { IgxTimeItemDirective } from './time-picker.directives' ;
18
+ import { IgxItemListDirective , IgxTimeItemDirective } from './time-picker.directives' ;
19
19
import { IgxPickerClearComponent , IgxPickerToggleComponent } from '../date-common/public_api' ;
20
20
import { Subscription } from 'rxjs' ;
21
+ import { HammerGesturesManager } from '../core/touch' ;
21
22
22
23
const CSS_CLASS_TIMEPICKER = 'igx-time-picker' ;
23
24
const CSS_CLASS_INPUTGROUP = 'igx-input-group' ;
@@ -435,6 +436,26 @@ describe('IgxTimePicker', () => {
435
436
date . setHours ( 20 ) ;
436
437
expect ( timePicker . validate ( mockFormControl ) ) . toEqual ( { maxValue : true } ) ;
437
438
} ) ;
439
+
440
+ it ( 'should handle panmove event correctly' , ( ) => {
441
+ const touchManager = new HammerGesturesManager ( null , null , new PlatformUtil ( 1 ) ) ;
442
+ const itemListDirective = new IgxItemListDirective ( timePicker , elementRef , touchManager ) ;
443
+ spyOn ( touchManager , 'addEventListener' ) ;
444
+
445
+ itemListDirective . ngOnInit ( ) ;
446
+ expect ( touchManager . addEventListener ) . toHaveBeenCalledTimes ( 1 ) ;
447
+ const hammerOptions : HammerOptions = { recognizers : [ [ Hammer . Pan , { direction : Hammer . DIRECTION_VERTICAL , threshold : 5 } ] ] } ;
448
+ expect ( touchManager . addEventListener ) . toHaveBeenCalledWith (
449
+ elementRef . nativeElement ,
450
+ 'pan' ,
451
+ ( itemListDirective as any ) . onPanMove ,
452
+ hammerOptions ) ;
453
+
454
+ spyOn < any > ( itemListDirective , 'onPanMove' ) . and . callThrough ( ) ;
455
+ const event = { type : 'pan' } ;
456
+ ( itemListDirective as any ) . onPanMove ( event ) ;
457
+ expect ( itemListDirective [ 'onPanMove' ] ) . toHaveBeenCalled ( ) ;
458
+ } ) ;
438
459
} ) ;
439
460
440
461
describe ( 'Interaction tests' , ( ) => {
0 commit comments