-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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: edge cases during cy.type in number input #6033
Conversation
Thanks for the contribution! Below are some guidelines Cypress uses when doing PR reviews.
PR Review ChecklistIf any of the following requirements can't be met, leave a comment in the review selecting 'Request changes', otherwise 'Approve'. User Experience
Functionality
Maintainability
Quality
Internal
|
Test summaryRun details
View run in Cypress Dashboard ➡️ This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard |
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 confirmed this is working and fixes the failing cases in the issues. Tests cover these 2 cases. 👍
@@ -260,7 +260,11 @@ const shouldUpdateValue = (el: HTMLElement, key: KeyDetails, options) => { | |||
|
|||
if (!(numberRe.test(potentialValue))) { | |||
debug('skipping inserting value since number input would be invalid', key.text, potentialValue) | |||
options.prevVal = needsValue + key.text | |||
if (key.text.match(/[-+eE\d\.]/)) { |
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.
this regexp
should be hoisted to the top and given a variable name to help describe what it is
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.
also a description would be helpful
if (!$elements.isInput(el)) { | ||
$selection.replaceSelectionContents(el, '\n') | ||
} |
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.
a description of why this is necessary would be helpful here.
Fix edge case introduced into cypress-io#6033 about typing invalid number Fixes cypress-io#6055
Fix edge case introduced into #6033 about typing invalid number Fixes #6055 Co-authored-by: Jennifer Shehane <[email protected]>
{enter} in input type=number
.type()
does not type chars in number input beyond special chars (like,
) #5997allow non-number chars in number input
User facing changelog
Additional details
How has the user experience changed?
PR Tasks