@@ -8,7 +8,7 @@ import { IgxLabelDirective } from '../directives/label/label.directive';
88import { IgxInputDirective } from '../directives/input/input.directive' ;
99import { UIInteractions , wait } from '../test-utils/ui-interactions.spec' ;
1010import { IgxInputGroupModule } from '../input-group' ;
11-
11+ import { IgxTextSelectionModule } from '../directives/text-selection/text-selection.directive' ;
1212import { configureTestSuite } from '../test-utils/configure-suite' ;
1313import { DateRangeType } from 'igniteui-angular' ;
1414import { IgxButtonModule } from '../directives/button/button.directive' ;
@@ -32,7 +32,8 @@ describe('IgxDatePicker', () => {
3232 IgxDropDownDatePickerRetemplatedComponent ,
3333 IgxDatePickerOpeningComponent
3434 ] ,
35- imports : [ IgxDatePickerModule , FormsModule , NoopAnimationsModule , IgxInputGroupModule , IgxCalendarModule , IgxButtonModule ]
35+ imports : [ IgxDatePickerModule , FormsModule , NoopAnimationsModule , IgxInputGroupModule , IgxCalendarModule ,
36+ IgxButtonModule , IgxTextSelectionModule ]
3637 } )
3738 . compileComponents ( ) ;
3839 } ) ) ;
@@ -1089,6 +1090,29 @@ describe('IgxDatePicker', () => {
10891090 expect ( instance . getEditElement ( ) ) . toBe ( editElement ) ;
10901091 } ) ;
10911092 } ) ;
1093+
1094+ describe ( 'Drop-down mode select all text on focus' , ( ) => {
1095+ let fixture : ComponentFixture < IgxDatePickerEditableComponent > ;
1096+ let datePicker : IgxDatePickerComponent ;
1097+
1098+ beforeEach ( ( ) => {
1099+ fixture = TestBed . createComponent ( IgxDatePickerEditableComponent ) ;
1100+ datePicker = fixture . componentInstance . datePicker ;
1101+ fixture . detectChanges ( ) ;
1102+ } ) ;
1103+
1104+ it ( 'Should select all input text on input focus' , fakeAsync ( ( ) => {
1105+ const input = fixture . debugElement . query ( By . directive ( IgxInputDirective ) ) . nativeElement ;
1106+ input . focus ( ) ;
1107+ fixture . detectChanges ( ) ;
1108+ tick ( 100 ) ;
1109+
1110+ expect ( input ) . toEqual ( document . activeElement ) ;
1111+ expect ( input . selectionEnd ) . toEqual ( input . value . length ) ;
1112+ expect ( input . selectionStart ) . toEqual ( 0 ) ;
1113+ expect ( input . value . substring ( input . selectionStart , input . selectionEnd ) ) . toEqual ( input . value ) ;
1114+ } ) ) ;
1115+ } ) ;
10921116} ) ;
10931117
10941118@Component ( {
0 commit comments