Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1095,7 +1095,7 @@ describe('IgxDateRangePicker', () => {
expect(dateRange.opening.emit).toHaveBeenCalledTimes(1);
expect(dateRange.opened.emit).toHaveBeenCalledTimes(1);

const calendarWrapper = document.getElementsByClassName('igx-calendar__wrapper')[0];
let calendarWrapper = document.getElementsByClassName('igx-calendar__wrapper')[0];
expect(calendarWrapper.contains(document.activeElement))
.withContext('focus should move to calendar for KB nav')
.toBeTrue();
Expand All @@ -1111,6 +1111,24 @@ describe('IgxDateRangePicker', () => {
.withContext('focus should return to the picker input')
.toBeTrue();
expect(dateRange.isFocused).toBeTrue();

// reopen and close again
UIInteractions.triggerEventHandlerKeyDown('ArrowDown', range, true);
tick(DEBOUNCE_TIME * 2);
fixture.detectChanges();

calendarWrapper = document.getElementsByClassName('igx-calendar__wrapper')[0];
expect(calendarWrapper.contains(document.activeElement))
.withContext('focus should move to calendar for KB nav')
.toBeTrue();
UIInteractions.triggerKeyDownEvtUponElem('ArrowUp', calendarWrapper, true, true);
tick();
fixture.detectChanges();

expect(startInput.nativeElement.contains(document.activeElement))
.withContext('focus should return to the picker input')
.toBeTrue();
expect(dateRange.isFocused).toBeTrue();
}));

it('should toggle the calendar with ALT + DOWN/UP ARROW key - dialog mode', fakeAsync(() => {
Expand Down Expand Up @@ -1153,7 +1171,7 @@ describe('IgxDateRangePicker', () => {
fixture.detectChanges();
expect(dateRange.collapsed).toBeFalsy();

const calendarWrapper = document.getElementsByClassName('igx-calendar__wrapper')[0];
let calendarWrapper = document.getElementsByClassName('igx-calendar__wrapper')[0];
expect(calendarWrapper.contains(document.activeElement))
.withContext('focus should move to calendar for KB nav')
.toBeTrue();
Expand All @@ -1170,6 +1188,24 @@ describe('IgxDateRangePicker', () => {
.withContext('focus should return to the picker input')
.toBeTrue();
expect(dateRange.isFocused).toBeTrue();

// reopen and close again
dateRange.open();
tick();
fixture.detectChanges();

calendarWrapper = document.getElementsByClassName('igx-calendar__wrapper')[0];
expect(calendarWrapper.contains(document.activeElement))
.withContext('focus should move to calendar for KB nav')
.toBeTrue();

UIInteractions.triggerKeyDownEvtUponElem('ArrowUp', calendarWrapper, true, true);
tick();
fixture.detectChanges();
expect(startInput.nativeElement.contains(document.activeElement))
.withContext('focus should return to the picker input')
.toBeTrue();
expect(dateRange.isFocused).toBeTrue();
}));

it('should not open calendar with ALT + DOWN ARROW key if disabled is set to true', fakeAsync(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -735,7 +735,6 @@ export class IgxDateRangePickerComponent extends PickerBaseDirective
// input click
if (this.hasProjectedInputs && this._focusedInput) {
this._focusedInput.setFocus();
this._focusedInput = null;
}
if (this.inputDirective) {
this.inputDirective.focus();
Expand Down Expand Up @@ -786,6 +785,7 @@ export class IgxDateRangePickerComponent extends PickerBaseDirective
}

private updateValidityOnBlur() {
this._focusedInput = null;
this.onTouchCallback();
if (this._ngControl) {
if (this.hasProjectedInputs) {
Expand Down
Loading