[ADF-3229] people widget list reseted if empty input (#3507)

* list reseted when input is empty

* test added
This commit is contained in:
bbcodrin 2018-06-20 15:08:46 +03:00 committed by Eugenio Romano
parent c1b12204f3
commit 7dd462fb1a
2 changed files with 13 additions and 0 deletions

View File

@ -169,6 +169,18 @@ describe('PeopleWidgetComponent', () => {
});
}));
it('should hide result list if input is empty', () => {
let peopleHTMLElement: HTMLInputElement = <HTMLInputElement> element.querySelector('input');
peopleHTMLElement.focus();
peopleHTMLElement.value = '';
peopleHTMLElement.dispatchEvent(new Event('keyup'));
peopleHTMLElement.dispatchEvent(new Event('input'));
fixture.detectChanges();
fixture.whenStable().then(() => {
fixture.detectChanges();
expect(fixture.debugElement.query(By.css('#adf-people-widget-user-0'))).toBeNull();
});
});
});
});

View File

@ -80,6 +80,7 @@ export class PeopleWidgetComponent extends WidgetComponent implements OnInit {
this.checkUserAndValidateForm(list, value);
} else {
this.field.value = null;
list = [];
}
return list;