Skip to content
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

FIO-8347: Added ability to skip mask validation #109

Merged
merged 6 commits into from
Aug 6, 2024

Conversation

roma-formio
Copy link
Contributor

@roma-formio roma-formio commented Jun 27, 2024

Link to Jira Ticket

https://formio.atlassian.net/browse/FIO-8347

Description

In Formio.js 4.x, we have the ability to skip mask validation by checking the skipMaskValidation property in the instance. To maintain backward compatibility, we have retained this instance check. This PR introduces the ability to skip mask validation by adding the skipMaskValidation flag to the validate object in the JSON configuration.

How has this PR been tested?

Unit testing

Checklist:

  • I have completed the above PR template
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (if applicable)
  • My changes generate no new warnings
  • My changes include tests that prove my fix is effective (or that my feature works as intended)
  • New and existing unit/integration tests pass locally with my changes
  • Any dependent changes have corresponding PRs that are listed above

const { component, value } = context;
if (!isValidatableComponent(component) || !value) {
const { component, value, instance } = context;
if (!isValidatableComponent(component) || !value || shouldSkipMaskValidation(context)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is something of a nit, but wouldn't the check for skipMaskValidation just be better inside of the isValidatableComponent fn?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

e.g. the component is not validatable if it has skipMaskValidation

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I refactored the isValidatableComponent function to improve readability. The previous implementation with two additional conditions made the function difficult to understand at first look. Is it fine?

@brendanbond brendanbond merged commit 583d006 into master Aug 6, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants