Skip to content

Commit

Permalink
fix(igx-autocomplete): focus input after drop down is closed #3585
Browse files Browse the repository at this point in the history
  • Loading branch information
Lipata committed Feb 1, 2019
1 parent a3d7948 commit f2c0ea7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -237,12 +237,16 @@ fdescribe('IgxAutocomplete', () => {
expect(dropDown.collapsed).toBeFalsy();

const targetElement = fixture.debugElement.queryAll(By.css('.' + CSS_CLASS_DROP_DOWN_ITEM))[0];
targetElement.nativeElement.tabIndex = 0;
targetElement.nativeElement.focus();
targetElement.nativeElement.click();
targetElement.nativeElement.tabIndex = -1;
tick();
fixture.detectChanges();
expect(dropDown.collapsed).toBeTruthy();
expect(fixture.componentInstance.townSelected).toBe(filteredTowns[0]);
expect(input.value).toBe(filteredTowns[0]);
expect(input.nativeElement).toBe(document.activeElement);
}));
it('Should filter and populate dropdown list with matching values on every key stroke', () => {
const dropdownListElement = fixture.debugElement.query(By.css('.' + CSS_CLASS_DROPDOWNLIST));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ export class IgxAutocompleteDirective extends IgxDropDownItemNavigationDirective
}
this.model ? this.model.control.setValue(newValue) : this.nativeElement.value = newValue;
this.close();
this.nativeElement.click();
}

private highlightFirstItem() {
Expand Down

0 comments on commit f2c0ea7

Please sign in to comment.