-
-
Notifications
You must be signed in to change notification settings - Fork 117
Closed
Description
I have the following situation
<EditForm Model="Variable" OnValidSubmit="OnValidSubmit">
</EditForm>
[Parameter]
public Variable Variable { get; set; } = new();
[Parameter]
public EventCallback Updated { get; set; }
protected async Task OnValidSubmit(EditContext context)
{
try
{
//code
await Updated.InvokeAsync();
}
catch (Exception ex)
{
ex.ProcessError(Toaster, Logger, context.Model);
}
}
and the following test
Action UpdatedHandler = () => { };
var model = FakeData.GetVariable().Generate();
var cut = ctx.RenderComponent<VariableData>(parameters => parameters
.Add(p => p.Updated, UpdatedHandler)
.Add(p => p.Variable, model)
);
cut.FindByTag("form").Submit();
Assert.AreEqual(true, cut.Instance.Updated.HasDelegate);
I know I can have any attribute and fill it with a value and test it, but if I don't want to go that way.
is there a way to test if an event has fired? in this case Update event.
Metadata
Metadata
Assignees
Labels
No labels