-
Notifications
You must be signed in to change notification settings - Fork 1k
Trigger validation using Form Field #5943
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
Conversation
Signed-off-by: GurkiranSingh <gurkiransinghk@gmail.com>
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.
A couple of small comments, otherwise I think the functionality is good.
src/js/components/Form/stories/TriggerValidationUsingFormField.js
Outdated
Show resolved
Hide resolved
Signed-off-by: GurkiranSingh <gurkiransinghk@gmail.com>
Signed-off-by: GurkiranSingh <gurkiransinghk@gmail.com>
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.
Thanks!
Any updates on this pr @ericsoderberghp @ShimiSun ? |
Apologies for such a long delay in responding to this. Thanks for the new story. I tried interacting with it in the following manner:
I didn't attempt to sift through the code to pinpoint where the issues might lie. But, I figured this testing might be helpful to start with. |
Signed-off-by: GurkiranSingh <gurkiransinghk@gmail.com>
Thank you for pointing out these issues.
One more thing I notice, Suppose, there are 3 Form fields wrapped around the form component, if the user specifies the Form level |
Signed-off-by: GurkiranSingh <gurkiransinghk@gmail.com>
@ericsoderberghp It's been a long time since this pr is reviewed. I will really appreciate your's and Grommet maintainers efforts to take some time out of your busy schedule to review this pr.
Apart from this scenario, I don't see any issues with this pr. Please, let me know if you find any unexpected behaviour. Thanks :) |
Hi @g4rry420 sorry for the long delay here. Thanks for reaching out to get some eyes on this again! I think this is super close to the finish line. The behavior looks good to me, I'm in the process of digging into the code a bit more to make sure things look good there.
Yes, I think that is the correct behavior. If validation is defined at the FormField level then that should override the Form level but only for that field. The other fields should align with the Form level validation. |
…lt use the validate prop value from the Form Signed-off-by: GurkiranSingh <gurkiransinghk@gmail.com>
@jcfilben Above discussed behavior is also implemented. Please, let me know if you see any issues :) |
Tested this out and storybook and so far it is looking good! Still working my way through the code. In the meantime I think it would be nice to have some unit tests for this. |
Signed-off-by: GurkiranSingh <gurkiransinghk@gmail.com>
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.
Thanks for adding tests! Just a minor comment on the story. Also looks like the bundlesize needs increased. This can be done in the package.json file. Just bump it up slightly to 144 kB.
src/js/components/Form/stories/TriggerValidationUsingFormField.js
Outdated
Show resolved
Hide resolved
…example Signed-off-by: GurkiranSingh <gurkiransinghk@gmail.com>
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 good!
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.
Apologies for the long delay getting this in.
I think the new story should be omitted from Chromatic snapshot evaluation, since it's there just for interaction. We can take care of this post-merge. |
Signed-off-by: GurkiranSingh gurkiransinghk@gmail.com
What does this PR do?
This pr provides the functionality to trigger validation using the Form Field.
Please, feel free to point out any mistakes.
Where should the reviewer start?
Form.js, FormField.js
What testing has been done on this PR?
Test using the
TriggerValidationUsingFormField.js
storyName. I have tested these scenario:How should this be manually tested?
Using the
TriggerValidationUsingFormField.js
Do Jest tests follow these best practices?
screen
is used for querying.userEvent
is used in place offireEvent
.asFragment()
is used for snapshot testing.Any background context you want to provide?
What are the relevant issues?
#5913
Screenshots (if appropriate)
Do the grommet docs need to be updated?
Yes
Should this PR be mentioned in the release notes?
Is this change backwards compatible or is it a breaking change?
backwards compatible