Problem/Motivation
Gin has a new feature to display all form items in a sticky bar which resides outside of the actual <form>
. This is natively support by HTML but will fail regular functional tests using submitForm()
as this assumes the form actions being part of the <form>
.
We temporarily override the submitForm()
so the PHPUnit tests within the Gin theme do not fail. However if you run any functional testing on the backend it will now potentially fail.
I can think of a couple of ways how we can easily solve this.
Steps to reproduce
Approach A:
Install Gin theme
Enable sticky form actions
Run PHPUnit tests on an admin form
Approach B:
Create form where button render outside the form actions
like:
<form action="/action_page.php" method="get" id="form1">
What is your favorite color? <input type="text" name="fav_color"><br>
<input type="submit">
</form>
<fieldset form="form1">
Name: <input type="text" name="username"><br>
Email: <input type="text" name="usermail"><br>
</fieldset>
Reference link: https://www.w3schools.com/tags/att_form.asp
Now if you try to add Phpunit test case for this form , then test fails.
Proposed resolution
Alter submitForm()
to support form actions being set outside of a <form>
.
Remaining tasks
Update submitForm()