I have the below list of companies populated in an ng-select
:
<div class="input-group">
<ng-select role="company" id="company" class="form-control" #Company
formControlName="company">
<ng-option *ngFor="let c of companies" [value]="c.id">
{{c.name}}
</ng-option>
</ng-select>
</div>
I am using Jest & Angular testing library to perform the required unit tests. The ng-select
is a searchable drop-down where users can type in keywords. I need to be able to type some text and press enter or click on the first option in the drop down in order to select the first option.
I am currently trying the below but that does not work:
userEvent.type(screen.getByRole('company'), companyName);
Is there an appropriate way to access the ng-select
? My code works fine for textboxes - it only has an issue with the ng-select
.