Skip to content

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