@@ -17,6 +17,7 @@ import { IgxDateTimeEditorModule, IgxDateTimeEditorDirective } from '../directiv
1717import { DateRangeType } from '../core/dates' ;
1818import { IgxDateRangePickerComponent , IgxDateRangeEndComponent } from './public_api' ;
1919import { IgxIconModule } from '../icon/public_api' ;
20+ import { AutoPositionStrategy } from '../services/public_api' ;
2021
2122// The number of milliseconds in one day
2223const ONE_DAY = 1000 * 60 * 60 * 24 ;
@@ -30,6 +31,7 @@ const CSS_CLASS_CALENDAR_TOGGLE = '.igx-toggle';
3031const CSS_CLASS_ICON = 'igx-icon' ;
3132const CSS_CLASS_DONE_BUTTON = 'igx-button--flat' ;
3233const CSS_CLASS_LABEL = 'igx-input-group__label' ;
34+ const CSS_CLASS_OVERLAY_CONTENT = 'igx-overlay__content' ;
3335
3436describe ( 'IgxDateRangePicker' , ( ) => {
3537 describe ( 'Unit tests: ' , ( ) => {
@@ -1119,6 +1121,23 @@ describe('IgxDateRangePicker', () => {
11191121 const result = fixture . componentInstance . formatter ( { start : startDate , end : endDate } ) ;
11201122 expect ( singleInputElement . nativeElement . value ) . toEqual ( result ) ;
11211123 } ) ;
1124+
1125+ it ( 'should invoke AutoPositionStrategy by default with proper arguments' , fakeAsync ( ( ) => {
1126+ fixture = TestBed . createComponent ( DateRangeDefaultComponent ) ;
1127+ fixture . detectChanges ( ) ;
1128+ spyOn < any > ( AutoPositionStrategy . prototype , 'position' ) ;
1129+
1130+ dateRange = fixture . componentInstance . dateRange ;
1131+ dateRange . open ( ) ;
1132+ tick ( ) ;
1133+ fixture . detectChanges ( ) ;
1134+
1135+ const overlayContent = document . getElementsByClassName ( CSS_CLASS_OVERLAY_CONTENT ) [ 0 ] as HTMLElement ;
1136+ expect ( AutoPositionStrategy . prototype . position ) . toHaveBeenCalledTimes ( 1 ) ;
1137+ expect ( AutoPositionStrategy . prototype . position )
1138+ . toHaveBeenCalledWith ( overlayContent , jasmine . anything ( ) , document ,
1139+ jasmine . anything ( ) , dateRange . element . nativeElement ) ;
1140+ } ) ) ;
11221141 } ) ;
11231142 } ) ;
11241143} ) ;
@@ -1135,7 +1154,7 @@ export class DateRangeTestComponent implements OnInit {
11351154 public minValue : Date | String ;
11361155 public maxValue : Date | String ;
11371156
1138- @ViewChild ( IgxDateRangePickerComponent , { read : IgxDateRangePickerComponent , static : true } )
1157+ @ViewChild ( IgxDateRangePickerComponent , { static : true } )
11391158 public dateRange : IgxDateRangePickerComponent ;
11401159
11411160 public ngOnInit ( ) : void {
0 commit comments