`submit()` helper
See original GitHub issueI would like to propose adding a submit()
test helper since submitting forms seems like a regular thing that is done in tests. We currently have two options:
click()
on atype="submit"
button- use
triggerEvent(..., 'submit')
but they are not entirely obvious and not specific to forms. Having a dedicated submit()
helper would make this a lot easier and could also add assertions on whether the passed selector actually belongs to a form, etc.
async function submit(selector) {
await triggerEvent(selector, 'submit');
}
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (5 by maintainers)
Top Results From Across the Web
Play Submissions Helper | Insane compendium of 400+ play ...
This Master List contains over 400 highly organized play submission opportunities around the country, seeking submissions RIGHT NOW, along with their submission ......
Read more >submit (ActionView::Helpers::FormBuilder) - APIdock
Add the submit button for the given form. When no value is given, it checks if the object is a new resource or...
Read more >paulzi/paulzi-form: JavaScript form helpers - GitHub
It provides the ability to send the form via AJAX, including forms with files. When submitting a form with input[type="file"] used XMLHttpRequest 2...
Read more >.submit() | jQuery API Documentation
An object containing data that will be passed to the event handler. ... A function to execute each time the event is triggered....
Read more ><input type="submit"> - HTML: HyperText Markup Language
An <input type="submit"> element's value attribute contains a string which is displayed as the button's label. Buttons do not have a true value ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
+1 for this.
I know I can use
triggerKeyEvent('button', 'keydown', 13)
andtriggerEvent('form', 'submit')
, but I specifically need to test that pressing enter when a text field is focused will submit the form (i.e. browser’s default behaviour)… ButtriggerEvent('input', 'keydown', 13)
will not accomplish that - well it does in the app, but not in the test suite.that, or pressing <kbd>Enter</kbd> in a form input
the form, same as for the raw
triggerEvent()
helper