Issue #2676 - Tests for v2 to prevent regression of issue from v1 #2829
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Added a basic test for radio input form submission, following the example for checkbox inputs.
Added tests for custom validation on radio and checkbox inputs when the inputs are empty, to support things like 'you must choose an option from at least one of these groups' etc.
These tests pass for v2 due to the refactoring of
processInputValue
in commitb9322450ff42a5bdf25b194fcdb6ecc744353819
: b932245#diff-f14ff7f8c91a6f76e7688c45ca01d600e8928769b268caa71cf09b8f12661f3dR2528-R2530validateElement
under different conditions, so while I'll submit the main bugfix for BUG: pre-submit custom form validation not applied to radiobuttons and checkboxes #2676 under v1, I would like to make sure there's test coverage of the problem for any future refactoring applied to this function in v2.Corresponding issue: #2676
Testing
As above - manually tested the fix in v1 using the replication sample attached to the ticket, wrote the tests and saw they failed when without the fix. Carried the fixes over to v2, saw that the tests passed now, checked why, and thought it best to submit the tests anyway.
Checklist
master
for website changes,dev
forsource changes)
approved via an issue
npm run test
) and verified that it succeeded