1
1
import { Component , ViewChild , ElementRef } from '@angular/core' ;
2
2
import { 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' ;
4
4
import { By } from '@angular/platform-browser' ;
5
5
import { NoopAnimationsModule } from '@angular/platform-browser/animations' ;
6
6
import { IgxDatePickerComponent , IgxDatePickerModule } from './date-picker.component' ;
@@ -206,7 +206,7 @@ describe('IgxDatePicker', () => {
206
206
expect ( input ) . toEqual ( document . activeElement ) ;
207
207
} ) ) ;
208
208
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' ,
210
210
fakeAsync ( ( ) => {
211
211
const datePickerDom = fixture . debugElement . query ( By . css ( 'igx-date-picker' ) ) ;
212
212
let overlayToggle = document . getElementsByClassName ( 'igx-overlay__wrapper--modal' ) ;
@@ -230,7 +230,7 @@ describe('IgxDatePicker', () => {
230
230
expect ( input ) . toEqual ( document . activeElement ) ;
231
231
} ) ) ;
232
232
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' ,
234
234
fakeAsync ( ( ) => {
235
235
const datePickerDom = fixture . debugElement . query ( By . css ( 'igx-date-picker' ) ) ;
236
236
let overlayToggle = document . getElementsByClassName ( 'igx-overlay__wrapper--modal' ) ;
@@ -939,7 +939,6 @@ describe('IgxDatePicker', () => {
939
939
940
940
// initial input value is 20-10-11 / dd-MM-yy
941
941
// focus the day part, position the caret at the beginning
942
- input . nativeElement . focus ( ) ;
943
942
input . nativeElement . setSelectionRange ( 0 , 0 ) ;
944
943
945
944
// press arrow up
@@ -984,7 +983,6 @@ describe('IgxDatePicker', () => {
984
983
985
984
// initial input value is 20-10-11 / dd-MM-yy
986
985
// focus the day part, position the caret at the beginning
987
- input . nativeElement . focus ( ) ;
988
986
input . nativeElement . setSelectionRange ( 0 , 0 ) ;
989
987
990
988
// press arrow down
@@ -1036,7 +1034,6 @@ describe('IgxDatePicker', () => {
1036
1034
1037
1035
// initial input value is 20-10-11 / dd-MM-yy
1038
1036
// focus the day part, position the caret at the beginning
1039
- input . nativeElement . focus ( ) ;
1040
1037
input . nativeElement . setSelectionRange ( 0 , 0 ) ;
1041
1038
1042
1039
// up
@@ -1149,7 +1146,8 @@ describe('IgxDatePicker', () => {
1149
1146
expect ( input ) . toBeDefined ( ) ;
1150
1147
datePicker . isSpinLoop = false ;
1151
1148
1152
- input . nativeElement . focus ( ) ;
1149
+ input . triggerEventHandler ( 'focus' , { } ) ;
1150
+ fixture . detectChanges ( ) ; // bound transformedDate assign
1153
1151
UIInteractions . sendInput ( input , '31-03-19' ) ;
1154
1152
expect ( input . nativeElement . value ) . toBe ( '31-03-19' ) ;
1155
1153
0 commit comments