-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding validatejs to validate forms #1005
Adding validatejs to validate forms #1005
Conversation
949ed36
to
36671e3
Compare
Codecov Report
@@ Coverage Diff @@
## master #1005 +/- ##
==========================================
- Coverage 93.03% 92.98% -0.05%
==========================================
Files 2449 2447 -2
Lines 80830 80662 -168
==========================================
- Hits 75197 75001 -196
- Misses 5633 5661 +28
Continue to review full report at Codecov.
|
0ebbc3e
to
c32c9e3
Compare
c32c9e3
to
672c95b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks ok to me but would be good if @didierofrivia also had a look
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
validateAllFields
is redundant, we should validate each field on change so that we can disable/enable the submit button depending on form's validity.
About the specs: they are not correct, handleChange is being mocked which is wrong (I left a comment about it). Also, there is no trace of validation in the specs although this PR is adding that. I think the following is missing:
- Add wrong value to a field -> check for "error" style and also error in state
- Add valid value to a field -> check for no "error" style and no error in state
- Add any wrong value to the form -> button should disable, and the other way around
- Check different wrong values such as empty, too short, different passwords, etc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've suggested just a change since I wanted to avoid duplicity since the changes suggested by @josemigallas are valid, specially the ones about the specs.
672c95b
to
55ef407
Compare
app/javascript/src/LoginPage/loginForms/RequestPassWordForm.jsx
Outdated
Show resolved
Hide resolved
8a84565
to
c321760
Compare
5d90550
to
1626bae
Compare
1626bae
to
02799ec
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tentatively approved
What this PR does / why we need it:
Adds form validation to PF4/React forms using Validate.js
Which issue(s) this PR fixes
https://issues.jboss.org/browse/THREESCALE-2993
Special notes for your reviewer:
Pros and cons of Validate.js
Pros:
Cons:
Demo: