This repository has been archived by the owner on Apr 12, 2024. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(input): use ValidityState to determine validity
In browsers where HTML5 constraint validation is (partially) implemented, an invalid number entered into an input[type=number] (for example) input element would be visible to the script context as the empty string. When the required or ngRequired attributes are not used, this results in the invalid state of the input being ignored and considered valid. To address this, a validator which considers the state of the HTML5 ValidityState object is used when available. Closes #4293 Closes #2144 Closes #4857 Closes #5120 Closes #4945 Closes #5500 Closes #5944
- Loading branch information
c2d447e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@juliemr I could use some help putting a test together for this. Theoretically, protractor E2E tests should be able to do it, however when I attempted this previously (description in #5944), I was unable to get the ValidityState to update using ptor.
When you have time, it would be really good if we could automate a test for this, or get a bit more certainty about it being impossible.
c2d447e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK - to recap, root problem with testing this via webdriver is that the browsers don't seem to want to update validity after sendKeys.
I should have time to run some tests over the weekend!
c2d447e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi !
It seems that the problem is back with the version v1.2.15-build.2364+sha.7c34e1f : myform.numericfield.$error.number is still not updated
c2d447e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pedubreuil please post a reproduction, it's impossible to help you or debug without more info
c2d447e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Chrome Version 33.0.1750.152 seems to be setting "badInput" and "valueMissing" to true at the same time.
c2d447e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rseidi please post a new issue for this, with a reproduction.
c2d447e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@caitp Issue with reproduction posted at #6818.