Trigger onsubmit event with submit type button #1765
-
I am trying to test how my form is submitted. Basically I have the following unit test:
This test is working as it is supposed to but. In my use case form submission is always triggered by a button press, so I would like to use a button click to submit my form. Basically, I want to write my unit test like this:
However, this is not triggering my OnSubmit method. Is there anyway to get this work? Thanks |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
That is interesting. We have a special case in TriggerEventDispatchExtensions exactly for that case as long as there is a TL;DR: Inside a Can you share your component under test? |
Beta Was this translation helpful? Give feedback.
That is interesting. We have a special case in TriggerEventDispatchExtensions exactly for that case as long as there is a
<form>
element as parent to that button.TL;DR: Inside a
<form>
you should be able to callClick
on a button that has type "submit" which would trigger the onsbumit event handler of said formCan you share your component under test?