diff --git a/lib/core/form/components/widgets/people/people.widget.spec.ts b/lib/core/form/components/widgets/people/people.widget.spec.ts index fc8523cd67..70298d1c01 100644 --- a/lib/core/form/components/widgets/people/people.widget.spec.ts +++ b/lib/core/form/components/widgets/people/people.widget.spec.ts @@ -169,6 +169,18 @@ describe('PeopleWidgetComponent', () => { }); })); + it('should hide result list if input is empty', () => { + let peopleHTMLElement: 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(); + }); + }); }); }); diff --git a/lib/core/form/components/widgets/people/people.widget.ts b/lib/core/form/components/widgets/people/people.widget.ts index 3449453ef3..bc8117c6c2 100644 --- a/lib/core/form/components/widgets/people/people.widget.ts +++ b/lib/core/form/components/widgets/people/people.widget.ts @@ -80,6 +80,7 @@ export class PeopleWidgetComponent extends WidgetComponent implements OnInit { this.checkUserAndValidateForm(list, value); } else { this.field.value = null; + list = []; } return list;