Skip to content

feat(forms): multiple validators for array method #20766

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

Closed
wants to merge 1 commit into from

Conversation

harunurhan
Copy link
Contributor

@harunurhan harunurhan commented Dec 3, 2017

Change array method signature so that array of validator and/or async
validatior functions can be passed.

Fixes #20665

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

[ ] Bugfix
[x] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Documentation content changes
[ ] angular.io application / infrastructure changes
[ ] Other... Please describe:

What is the current behavior?

Issue Number: #20665

What is the new behavior?

Does this PR introduce a breaking change?

[ ] Yes
[x] No

Other information

Can remove the test if requested, it doesn't seem to be really useful.

Copy link
Contributor

@kara kara left a comment

Choose a reason for hiding this comment

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

This looks good, but needs a few tests. Can you add a test that passing multiple validators to FormBuilder works as expected?

@kara kara added the action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews label Jan 26, 2018
@harunurhan
Copy link
Contributor Author

@kara I wanted to add test at the beginning but I wasn't sure how to assert since multiple validators are composed into a single function eventually.

I pushed a test now which is not working, maybe you know how to do assertion here.

@kara
Copy link
Contributor

kara commented Jan 26, 2018

@harunurhan Rather than checking function identity, try checking whether both async validators have been called as expected. You can use https://github.com/angular/angular/blob/master/packages/forms/test/form_array_spec.ts#L810 as a model.

@harunurhan harunurhan force-pushed the fix-20665 branch 2 times, most recently from 1f96304 to 6c2ba5a Compare January 27, 2018 20:01
Change array method signature so that array of validator and/or async
validatior functions can be passed.

Fixes angular#20665
@harunurhan
Copy link
Contributor Author

@kara thanks for the tip, pushed new tests. you can have a look.

Copy link
Contributor

@kara kara left a comment

Choose a reason for hiding this comment

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

LGTM

@kara kara added target: major This PR is targeted for the next major release action: merge The PR is ready for merge by the caretaker and removed action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews action: merge The PR is ready for merge by the caretaker labels Jan 30, 2018
@kara kara requested a review from IgorMinar January 30, 2018 18:44
@kara kara added the action: review The PR is still awaiting reviews from at least one requested reviewer label Jan 30, 2018
@kara
Copy link
Contributor

kara commented Jan 30, 2018

@IgorMinar Can you take a look for public-api changes?

@IgorMinar IgorMinar added action: merge The PR is ready for merge by the caretaker and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Feb 4, 2018
@kara
Copy link
Contributor

kara commented Feb 7, 2018

presubmit

@mhevery mhevery closed this in 941e88f Feb 7, 2018
jbogarthyde pushed a commit to jbogarthyde/angular that referenced this pull request Feb 23, 2018
Change array method signature so that array of validator and/or async
validatior functions can be passed.

Fixes angular#20665

PR Close angular#20766
leo6104 pushed a commit to leo6104/angular that referenced this pull request Mar 25, 2018
Change array method signature so that array of validator and/or async
validatior functions can be passed.

Fixes angular#20665

PR Close angular#20766
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 13, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker area: forms cla: yes target: major This PR is targeted for the next major release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add ability to set several validators with FormBuilder.array method
4 participants