Skip to content

Commit e88e576

Browse files
committed
test(drp): add tests for open on click + fix existing one
1 parent 08730a7 commit e88e576

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

projects/igniteui-angular/src/lib/date-range-picker/date-range-picker.component.spec.ts

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -810,11 +810,27 @@ describe('IgxDateRangePicker', () => {
810810
expect(fixture.componentInstance.dateRange.collapsed).toBeFalsy();
811811
}));
812812

813-
it('should not expand the calendar if the default icon is clicked when disabled is set to true', fakeAsync(() => {
813+
it('should not expand the calendar if the input is clicked in dropdown mode', fakeAsync(() => {
814+
UIInteractions.simulateClickAndSelectEvent(dateRange.getEditElement());
815+
tick();
816+
fixture.detectChanges();
817+
expect(fixture.componentInstance.dateRange.collapsed).toBeTruthy();
818+
}));
819+
820+
it('should expand the calendar if the input is clicked in dialog mode', fakeAsync(() => {
821+
dateRange.mode = PickerInteractionMode.Dialog;
822+
fixture.detectChanges();
823+
UIInteractions.simulateClickAndSelectEvent(dateRange.getEditElement());
824+
fixture.detectChanges();
825+
tick();
826+
expect(fixture.componentInstance.dateRange.collapsed).toBeFalsy();
827+
}));
828+
829+
it('should not expand the calendar if the default icon (in prefix) is clicked when disabled is set to true', fakeAsync(() => {
814830
fixture.componentInstance.disabled = true;
815831
fixture.detectChanges();
816-
const input = fixture.debugElement.query(By.css('igx-input-group'));
817-
input.triggerEventHandler('click', UIInteractions.getMouseEvent('click'));
832+
const prefix = fixture.debugElement.query(By.directive(IgxPrefixDirective));
833+
prefix.triggerEventHandler('click', UIInteractions.getMouseEvent('click'));
818834
tick();
819835
fixture.detectChanges();
820836
expect(fixture.componentInstance.dateRange.collapsed).toBeTruthy();

0 commit comments

Comments
 (0)