11import { Component , ViewChild , ElementRef } from '@angular/core' ;
22import { async , fakeAsync , TestBed , tick , flush , ComponentFixture } from '@angular/core/testing' ;
3- import { FormsModule , FormGroup , FormBuilder , FormControl , ReactiveFormsModule } from '@angular/forms' ;
3+ import { FormsModule , FormGroup , FormBuilder , FormControl , ReactiveFormsModule } from '@angular/forms' ;
44import { By } from '@angular/platform-browser' ;
55import { NoopAnimationsModule } from '@angular/platform-browser/animations' ;
66import { IgxDatePickerComponent , IgxDatePickerModule } from './date-picker.component' ;
@@ -206,7 +206,7 @@ describe('IgxDatePicker', () => {
206206 expect ( input ) . toEqual ( document . activeElement ) ;
207207 } ) ) ;
208208
209- it ( 'When a modal datepicker is closed via outside click, the focus should remain on the input' ,
209+ it ( 'When a modal datepicker is closed via outside click, the focus should remain on the input' ,
210210 fakeAsync ( ( ) => {
211211 const datePickerDom = fixture . debugElement . query ( By . css ( 'igx-date-picker' ) ) ;
212212 let overlayToggle = document . getElementsByClassName ( 'igx-overlay__wrapper--modal' ) ;
@@ -230,7 +230,7 @@ describe('IgxDatePicker', () => {
230230 expect ( input ) . toEqual ( document . activeElement ) ;
231231 } ) ) ;
232232
233- it ( 'When datepicker is closed upon selecting a date, the focus should remain on the input' ,
233+ it ( 'When datepicker is closed upon selecting a date, the focus should remain on the input' ,
234234 fakeAsync ( ( ) => {
235235 const datePickerDom = fixture . debugElement . query ( By . css ( 'igx-date-picker' ) ) ;
236236 let overlayToggle = document . getElementsByClassName ( 'igx-overlay__wrapper--modal' ) ;
@@ -939,7 +939,6 @@ describe('IgxDatePicker', () => {
939939
940940 // initial input value is 20-10-11 / dd-MM-yy
941941 // focus the day part, position the caret at the beginning
942- input . nativeElement . focus ( ) ;
943942 input . nativeElement . setSelectionRange ( 0 , 0 ) ;
944943
945944 // press arrow up
@@ -984,7 +983,6 @@ describe('IgxDatePicker', () => {
984983
985984 // initial input value is 20-10-11 / dd-MM-yy
986985 // focus the day part, position the caret at the beginning
987- input . nativeElement . focus ( ) ;
988986 input . nativeElement . setSelectionRange ( 0 , 0 ) ;
989987
990988 // press arrow down
@@ -1036,7 +1034,6 @@ describe('IgxDatePicker', () => {
10361034
10371035 // initial input value is 20-10-11 / dd-MM-yy
10381036 // focus the day part, position the caret at the beginning
1039- input . nativeElement . focus ( ) ;
10401037 input . nativeElement . setSelectionRange ( 0 , 0 ) ;
10411038
10421039 // up
@@ -1149,7 +1146,8 @@ describe('IgxDatePicker', () => {
11491146 expect ( input ) . toBeDefined ( ) ;
11501147 datePicker . isSpinLoop = false ;
11511148
1152- input . nativeElement . focus ( ) ;
1149+ input . triggerEventHandler ( 'focus' , { } ) ;
1150+ fixture . detectChanges ( ) ; // bound transformedDate assign
11531151 UIInteractions . sendInput ( input , '31-03-19' ) ;
11541152 expect ( input . nativeElement . value ) . toBe ( '31-03-19' ) ;
11551153
0 commit comments