-
Notifications
You must be signed in to change notification settings - Fork 219
Custom validation messages using the field name/label #8143
Conversation
The release ZIP for this PR is accessible via:
Script Dependencies ReportThere is no changed script dependency between this branch and trunk. This comment was automatically generated by the TypeScript Errors Report
🎉 🎉 This PR does not introduce new TS errors. |
Size Change: +75 B (0%) Total Size: 1.08 MB
ℹ️ View Unchanged
|
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 Mike, what you've done looks and works great, but could we add unit tests for getValidityMessageForInput
please, and possibly an integration test for ValidatedTextInput
to ensure the correct values are being passed to setValidationErrors
? (If you think that's necessary). I can help with this if needed.
6755c33
to
43e37eb
Compare
Remaining fails are unrelated so ready for review @opr |
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.
Nice, thanks for adding the tests 👍🏼
Implements a new helper function called
getValidityMessageForInput
, which is passed the field label. Thevalidity
of the field can then be used to generate a custom error message, in this case:This is then used to create an appropriate validation message.
Fixes #7729
Other Checks
Testing
Automated Tests
User Facing Testing
WooCommerce Visibility
Performance Impact
Changelog