A testing library for Blazor components. Get started testing Blazor components at bunit.egilhansen.com/docs/getting-started/
ctx.Services.AddSingleton<NavigationManager, FakeNavigationManager>()
Fixture
type. Not sure if that is the cleanest solution though.Fixture
is a TestContextBase
.
EditForm
component with a button as a child element the EditForm
get triggered by clicking on that button. But if I try to do a "Click" via bUnit it says there is no click handler registered, which makes sense. But not sure how to submit the form via bUnit's api?
var cut = Render(@<ManageUser ConfirmPasswordChange="DummyActions.AlwaysTrueFunc"
OnPasswordUpdate="DummyActions.OnEvent"></ManageUser>);
cut.Find("#new-password").Change("Test123!");
cut.Find("#new-password-confirm").Change("Test123!");
cut.Find("#old-password").Change("Admin123!");
OnInitializeAsync
. I have switched the order of these find statements and whatever the order the first of the three calls is null
in the rendered markup while the other have expected values.
MyCompoent.ImDoneNow
, then you can also inspect that. E.g. cut.WaitForState(() => cut.Instance.ImDoneNow);
WaitForElement
/WaitForElements
that will make it a little less verbose.cut.WaitForState(() => cut.FindAll("elementSelector").Count == 1)