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

Fix: TextType - Over-length value validates when both max and min spe… #4537

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

gsteinert
Copy link

…cified #4536

Description of changes

Change validation logic for TextType to ensure an overlength string is invalidated when both max and min are specified.
Tests to support

Related issues (if any)

#4536

Testing

  • Please confirm npm run test-all ran successfully.
    No new failures. 7 failed tests in unrelated areas, all pre-existing.

@autoboxer
Copy link
Contributor

looks good @gsteinert, but I think there might be one more needed change. When result is initialized, there's a check on the passed in value:

var result = value === undefined || value === null || typeof value === 'string';

It seems like the check you added needs to be mirrored in the max check as well to not lose that validation:

if (result && max && typeof value === 'string') {
    result = value.length < max;
}

What happens in you branch if a value is given that fails the first check (isn't undefined, null, or a string)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants