Skip to content

Support multiple validators to Incubator.TextField #927

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

Merged
merged 2 commits into from
Sep 15, 2020

Conversation

ethanshar
Copy link
Collaborator

@ethanshar ethanshar commented Sep 7, 2020

Description

  • Add support for multiple validators in Incubator.TextField to have parity with our current TextField component
  • Move logic to Presenter and add appropriate unit tests to validate and getRelevantValidationMessage functions.

Changelog

Add multi validator support to Incubator.TextField.

export function validate(
value: string | undefined,
validator?: Validator | Validator[]
): [boolean, number | undefined] {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can't value and the number be optionals instead?
validate( value?: string, validator?: Validator | Validator[] ): [boolean, number?]

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed

@@ -11,3 +13,6 @@ export enum ValidationMessagePosition {
TOP = 'top',
BOTTOM = 'bottom'
}


export type Validator = Function | keyof typeof formValidators;
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing newline

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed

@ethanshar ethanshar requested a review from mendyEdri September 13, 2020 05:26
@mendyEdri mendyEdri merged commit 61c4d61 into master Sep 15, 2020
@ethanshar ethanshar deleted the feat/multipleValidators branch September 21, 2020 08:02
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