Below is a list of companies displayed 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>
In order to perform the necessary unit tests, I am using Jest and Angular testing library. The ng-select
serves as a searchable drop-down where users can enter keywords. To select the first option by typing text and pressing enter or clicking on the first option, what approach should be taken?
The following method I'm attempting does not achieve the desired result:
userEvent.type(screen.getByRole('company'), companyName);
How can I effectively access the ng-select
? My current method works for textboxes but encounters issues with ng-select
.