-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
fix(input): fix placeholder for number input with bad input. #2362
Conversation
return true; | ||
} | ||
return false; | ||
} |
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.
Seems a bit complex with four different return
statements. How about:
return !this._isNeverEmpty() &&
(this.value == null || this.value === '') &&
!this._isBadInput();
// Check if this is an <input> element that contains bad input. | ||
// If so, we know that it only appears empty because the value failed to parse. | ||
if (this._elementRef.nativeElement instanceof HTMLInputElement && | ||
this._elementRef.nativeElement.validity.badInput) { |
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.
Add a unit test for this case?
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.
I tried, but you can't programaticaly set the value to a bad input. I'd have to simulate key presses which sounded like more trouble than its worth
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.
In that case just add a TODO to add an e2e test for this
LGTM |
@mmalerba Can you rebase? |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
No description provided.