@@ -11,7 +11,7 @@ import { PickerInteractionMode } from '../date-common/types';
11
11
import { IgxIconModule } from '../icon/public_api' ;
12
12
import { IgxToggleDirective } from '../directives/toggle/toggle.directive' ;
13
13
import { PlatformUtil } from '../core/utils' ;
14
- import { DatePart } from '../directives/date-time-editor/public_api' ;
14
+ import { DatePart , IgxDateTimeEditorDirective } from '../directives/date-time-editor/public_api' ;
15
15
import { DateTimeUtil } from '../date-common/util/date-time.util' ;
16
16
17
17
const CSS_CLASS_TIMEPICKER = 'igx-time-picker' ;
@@ -182,7 +182,7 @@ describe('IgxTimePicker', () => {
182
182
183
183
describe ( 'Interaction tests' , ( ) => {
184
184
let fixture : ComponentFixture < any > ;
185
- let timePickerElement : any ;
185
+ let timePickerElement : DebugElement ;
186
186
let inputGroup : DebugElement ;
187
187
let input : DebugElement ;
188
188
let hourColumn : DebugElement ;
@@ -210,9 +210,9 @@ describe('IgxTimePicker', () => {
210
210
fixture = TestBed . createComponent ( IgxTimePickerTestComponent ) ;
211
211
fixture . detectChanges ( ) ;
212
212
timePicker = fixture . componentInstance . timePicker ;
213
- timePickerElement = fixture . debugElement . query ( By . css ( CSS_CLASS_TIMEPICKER ) ) . nativeElement ;
213
+ timePickerElement = fixture . debugElement . query ( By . css ( CSS_CLASS_TIMEPICKER ) ) ;
214
214
inputGroup = fixture . debugElement . query ( By . css ( `.${ CSS_CLASS_INPUTGROUP } ` ) ) ;
215
- input = fixture . debugElement . query ( By . css ( `. ${ CSS_CLASS_INPUT } ` ) ) ;
215
+ input = fixture . debugElement . query ( By . css ( CSS_CLASS_INPUT ) ) ;
216
216
hourColumn = fixture . debugElement . query ( By . css ( CSS_CLASS_HOURLIST ) ) ;
217
217
toggleDirectiveElement = fixture . debugElement . query ( By . directive ( IgxToggleDirective ) ) ;
218
218
toggleDirective = toggleDirectiveElement . injector . get ( IgxToggleDirective ) as IgxToggleDirective ;
@@ -237,7 +237,7 @@ describe('IgxTimePicker', () => {
237
237
} ) ) ;
238
238
239
239
it ( 'should open the dropdown with `ArrowDown` + `Alt` key press and close it on outside click' , fakeAsync ( ( ) => {
240
- input . nativeElement . dispatchEvent ( new KeyboardEvent ( 'keydown ', { key : 'ArrowDown' , altKey : true } ) ) ;
240
+ UIInteractions . triggerEventHandlerKeyDown ( 'ArrowDown ', timePickerElement , true ) ;
241
241
tick ( ) ;
242
242
fixture . detectChanges ( ) ;
243
243
expect ( toggleDirective . collapsed ) . toBeFalsy ( ) ;
@@ -281,7 +281,7 @@ describe('IgxTimePicker', () => {
281
281
} ) ) ;
282
282
283
283
it ( 'should open/close the dropdown and keep the current selection on Space/Enter key press' , fakeAsync ( ( ) => {
284
- UIInteractions . triggerKeyDownEvtUponElem ( 'Space ', input . nativeElement , true ) ;
284
+ UIInteractions . triggerEventHandlerKeyDown ( ' ', timePickerElement ) ;
285
285
tick ( ) ;
286
286
fixture . detectChanges ( ) ;
287
287
expect ( toggleDirective . collapsed ) . toBeFalsy ( ) ;
@@ -314,7 +314,7 @@ describe('IgxTimePicker', () => {
314
314
hourColumn . triggerEventHandler ( 'wheel' , event ) ;
315
315
fixture . detectChanges ( ) ; hourColumn . triggerEventHandler ( 'wheel' , event ) ;
316
316
fixture . detectChanges ( ) ;
317
- const selectedHour = fixture . componentInstance . date . getHours ( ) - 3 ;
317
+ const selectedHour = fixture . componentInstance . date . getHours ( ) + 2 ;
318
318
expect ( ( timePicker . value as Date ) . getHours ( ) ) . toEqual ( selectedHour ) ;
319
319
320
320
UIInteractions . triggerKeyDownEvtUponElem ( 'Escape' , input . nativeElement , true ) ;
@@ -646,8 +646,7 @@ describe('IgxTimePicker', () => {
646
646
template : `
647
647
<igx-time-picker #picker [value]="date" [mode]="mode" [minValue]="minValue" [maxValue]="maxValue">
648
648
<label igxLabel>Select time</label>
649
- </igx-time-picker>
650
- `
649
+ </igx-time-picker>`
651
650
} )
652
651
export class IgxTimePickerTestComponent {
653
652
@ViewChild ( 'picker' , { read : IgxTimePickerComponent , static : true } )
0 commit comments