-
-
Couldn't load subscription status.
- Fork 115
Closed
Description
We have a regression in version 1.17 where "clicking" a submit button doesn't trigger the onsubmit event of the form itself.
Now technically the button does not have a onclick event but we allowed that prior to version 1.17. So it is open for discussion if we are now technical correct (even though in a browser it would work differently).
Reproduction
Following component:
<form id="my-form" @onsubmit="() => FormSubmitted = true">
<input id="inside-form-input" type="submit" value="Submit" />
</form>
@code {
public bool FormSubmitted;
}Test:
[Fact(DisplayName = "Should submit a form on submit button")]
public void Test308()
{
var cut = RenderComponent<SubmitFormButton>();
cut.Find("#inside-form-input").Click();
cut.Instance.FormSubmitted.ShouldBeTrue();
}But leads to:
Bunit.MissingEventHandlerException: The element does not have an event handler for the event 'onclick', nor any other events.
Bunit.MissingEventHandlerException
The element does not have an event handler for the event 'onclick', nor any other events.
at Bunit.TriggerEventDispatchExtensions.TriggerBubblingEventAsync(ITestRenderer renderer, IElement element, String eventName, EventArgs eventArgs) in /Users/stgi/repos/bUnit/src/bunit.web/EventDispatchExtensions/TriggerEventDispatchExtensions.cs:line 125
at Bunit.TriggerEventDispatchExtensions.TriggerEventsAsync(ITestRenderer renderer, IElement element, String eventName, EventArgs eventArgs) in /Users/stgi/repos/bUnit/src/bunit.web/EventDispatchExtensions/TriggerEventDispatchExtensions.cs:line 90
at Microsoft.AspNetCore.Components.Rendering.RendererSynchronizationContext.<>c.<<InvokeAsync>b__9_0>d.MoveNext()
--- End of stack trace from previous location ---
at Bunit.TriggerEventDispatchExtensions.ThrowIfFailedSynchronously(Task result) in /Users/stgi/repos/bUnit/src/bunit.web/EventDispatchExtensions/TriggerEventDispatchExtensions.cs:line 199
at Bunit.TriggerEventDispatchExtensions.TriggerEventAsync(IElement element, String eventName, EventArgs eventArgs) in /Users/stgi/repos/bUnit/src/bunit.web/EventDispatchExtensions/TriggerEventDispatchExtensions.cs:line 77
at Bunit.MouseEventDispatchExtensions.ClickAsync(IElement element, MouseEventArgs eventArgs) in /Users/stgi/repos/bUnit/src/bunit.web/EventDispatchExtensions/MouseEventDispatchExtensions.cs:line 373
at Bunit.MouseEventDispatchExtensions.Click(IElement element, Int64 detail, Double screenX, Double screenY, Double clientX, Double clientY, Double pageX, Double pageY, Double offsetX, Double offsetY, Int64 button, Int64 buttons, Boolean ctrlKey, Boolean shiftKey, Boolean altKey, Boolean metaKey, String type) in /Users/stgi/repos/bUnit/src/bunit.web/EventDispatchExtensions/MouseEventDispatchExtensions.cs:line 289
at Bunit.GeneralEventDispatchExtensionsTest.Test308() in /Users/stgi/repos/bUnit/tests/bunit.web.tests/EventDispatchExtensions/GeneralEventDispatchExtensionsTest.cs:line 286
at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)
Metadata
Metadata
Assignees
Labels
No labels