I have a dropdown list in my Blazor component and as part of testing the component I need to select a value in the dropdown and I am unsure how to do this from the bUnit test.
The dropdown appears like this:
<SfDropDownList @ref="DataSelector" TValue="string" TItem="DataRecord" DataSource="DatasToSelect" Placeholder="Pick an Item" AllowFiltering="true">
<DropDownListFieldSettings Text="DisplayName" Value="IdString"></DropDownListFieldSettings>
<DropDownListEvents TItem="DataRecord" TValue="string" ValueChange="@ValueChangeHandler" ></DropDownListEvents>
</SfDropDownList>
In my test I get the dropdown component using:
var dropdown = cut.FindComponent<SfDropDownList<string, DataRecord>>();
How to I select a value in the dropdown?
I have tried :
dropdown.Instance.Value = "id"
but this does not select the item in the dropdown.
Do you have an example of handling dropdown controls in unit testing?
Many thanks,
Tim