-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Typing {{arrowUp}}
should trigger event on input[type=number]
#29611
Comments
Can I collaborate in resolving this bug? |
Sure @thevladisss. At initial discovery, this part seems the one responsible. |
@Abdillah I spent some time investigating this issue and it appears like your issue is quite natural, as under the hood it calls "stepUp" and "stepDown" on input type number. This method does not trigger any event on the input, unlilke clicking arrows on input type number. @jennifer-shehane I think that {upArrow} actually implies that user clicks up arrow key, which does trigger events on the input, as it is same as clicking on the arrows. Do you beleive I can work on implementing this behavior? |
Yes, that is spot on. That doesn't match with user expectation using Cypress for real world arrow up behavior. |
@jennifer-shehane Can I start working on this? |
Arrow up can be simulated using the following way (a work around). const arrowDown = $el => {
const v = parseInt($el.val())++
cy.wrap($el).type('{selectAll}' + v)
}
const arrowDown = $el => {
const v = parseInt($el.val())--
cy.wrap($el).type('{selectAll}' + v)
}
cy.get('input[type=number]').then(arrowUp)
cy.get('input[type=number]').then(arrowDown) Edited: use |
I think there should be a solution rather than workaround. There is certain specific behaviour about type number that cannot be just covered by adding value unfortunately |
@thevladisss Actually, Cypress team has considered this as a bug, you can just create a PR and request them for review rather than waiting for them (they have lots of issue to triage). Currently I'm not available to tackle this issue but need to get things done, hence the workaround. |
If you need some discussion, @thevladisss, you can throw it here. I can be your second brain. |
Thanks! Once I get something I will comeback here. |
Released in This comment thread has been locked. If you are still experiencing this issue after upgrading to |
Current behavior
Currently,
get('input[type=number]').type('{{arrowUp}}')
has the same behavior as callinginput.stepUp()
only which will not trigger any event, like when we press arrow up on the input.Desired behavior
Typing
{{arrowUp}}
should be equal as pressing arrow up button on a focused number input. Pressing real arrow up button will triggerinput
event.Test code to reproduce
This will not show any alert:
versus
which will show an alert. Or try the input DOM in browser and press arrow up button.
Cypress Version
13.2.0
Node version
18.16.0
Operating System
NixOS 23.11
Debug Logs
No response
Other
No response
The text was updated successfully, but these errors were encountered: