-
-
Notifications
You must be signed in to change notification settings - Fork 117
Closed
Closed
Copy link
Milestone
Description
Given the following component:
<EditForm Model="model" OnValidSubmit="CreateTalk">
<DataAnnotationsValidator />
<InputText class="form-control" id="talk-title" @bind-Value="model.Title" />
<button>Submit</button>
</EditForm>
@code {
[Parameter]
public EventCallback Created { get; set; }
private Model model = new();
private async Task CreateTalk()
{
await Created.InvokeAsync();
model = new Model();
}
public sealed class Model
{
public string? Title { get; set; }
}
}And the following test:
var wasInvoked = false;
var cut = Render<TalkForm>(
ps => ps.Add(p => p.Created, o => wasInvoked = true));
cut.Find("#talk-title").Change("title");
cut.Find("form").Submit();
wasInvoked.ShouldBeTrue();we get an:
System.ArgumentException: The renderer does not have a component with ID 6.
The interesting part is when:
- We don't new up the model after the emit (
model = new Model();): the test passes - We remove the Validator (
DataAnnotationsValidator): the test passes
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels