Skip to content

feat(forms) Add validators min and max with their tests. - #13688

Closed
AnObstacle wants to merge 1 commit into
angular:masterfrom
AnObstacle:master
Closed

AnObstacle wants to merge 1 commit into
angular:masterfrom
AnObstacle:master

Conversation

@AnObstacle

Copy link
Copy Markdown
Contributor

What kind of change does this PR introduce? (check one with "x")

[x] Feature

What is the new behavior?
Add min max validation for numeric input (like min max in html input)

Does this PR introduce a breaking change? (check one with "x")

[x] No

@vicb vicb added area: forms action: review The PR is still awaiting reviews from at least one requested reviewer labels Dec 28, 2016

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

mistake of new FormControl(undefined)?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Maybe, I confess I just copy and past the tests for minlength and maxlength. Then i change them to use the min and max function I have created.
Do I also change the null to undefined in the others tests?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think you don't have to touch other tests.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ok, then it is done.

@mhevery

mhevery commented Feb 10, 2017

Copy link
Copy Markdown
Contributor

@kara do we want to keep this? If so we would need to resurrect this PR, get it to pass and rebase.

@kara kara left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for the PR! Can you add the validator directives and some template-driven integration tests for them? Then should be good.

expect(Validators.min(2)(new FormControl(3))).toBeNull();
});

it('should not error on equals values', () => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Typo: equals -> equal (same on line 185)


/**
* Validator that requires controls to have a value of a minimum number.
*/

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This currently only works with reactive forms. Can we add the corresponding directives that provide these validators?

@kara kara added action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Mar 9, 2017
@DzmitryShylovich

Copy link
Copy Markdown
Contributor

@Mathou54 can you please update the commit message so it will automatically close #15053 ? thanks

@kara

kara commented Apr 10, 2017

Copy link
Copy Markdown
Contributor

Looks like this PR has become stale :(. I'm going to close for now since there is another PR for this feature that is more active.

@angular-automatic-lock-bot

Copy link
Copy Markdown

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 11, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews area: forms cla: yes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants