-
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
Change event is not fired on number input #1171
Comments
Appreciate you putting together a detailed bug report. We'll look at this. |
|
Just to piggyback on this really detailed bug, I'm actually encountering the same bug with number fields and change events not firing. Specifically however I believe it's only happening when the input contains a decimal (at least in our case). If I use the following command
When I change the command to include a decimal --
This works with or without single quotes around the number in question. |
I'd like to add that we are having this same issue, but for |
@mjfaga I think I'm experimenting the same issue with |
@jbmusso I can reproduce this by running the following in my console...
...and then clicking the submit button on my form manually. From the research I've done, it comes down to that fact that doing what I note above doesn't trigger the react life cycle events, so the react change event is never fired, and therefore, the field doesn't technically have a value as a result. I can get things working when using That is as far as I've gotten thus far. No work around yet. |
Thanks for sharing. Our app is a single page app (React). cy
.get('input[name="birthDate"]')
.type('1970-06-15')
.should('have.value', '1970-06-15') // Failed assertion
// Workaround, cast to "type"
cy
.get('input[name="birthDate"]')
.invoke('attr', 'type', 'text')
.should('have.value', '1970-06-15') // Successful assertion It looks like that the change event now fires, which triggers form validation (use case: form validation using Also, wrapped up: cy
.get('input[name="birthDate"]')
.invoke('attr', 'type', 'text') // Cast
.type('1970-06-15')
.should('have.value', '1970-06-15') // Successful assertion |
In my situaion, cy.get('input').type('10.0001').trigger('blur'); I set something for input#onBlur, but seems input#onChange didn't work when with decimals |
This issue will be fixed in PR #2016 along with many other |
It seems that the issue still occurs on the current version type: "number" Removing both accepts the values. |
@ervicsangel are you saying using the |
The scenarios are:
The test data provided is merely '222222' UPDATE: I just found out that it does not work when using mat-form-field. I tried rerunning it against a simple input box and it worked; changing it back to mat-form-field (textbox), the issue recurred. Cheers |
@ervicsangel can you provide a reproducible example using the |
I think it was because the Cheers |
Thank you. I was getting frustrated with my decimals not typing in and just by upgrading I got past it.. |
I have the issue that in browser the input field is |
I'm using Cypress with the following versions (installed yesterday): Cypress package version: 3.5.0 Using |
Worked around by manually triggering by calling |
This issue will be closed to further comment as the exact issue here was resolved and tested. If you're experiencing a bug similar to this in Cypress, please open a new issue with a fully reproducible example that we can run. There may be a specific edge case with the issue that we need more detail to fix. |
Is this a Feature or Bug?
Bug
Current behavior:
Change event is not fired on "number" type inputs after .type() nor .click() or .focus() to other element.
It works fine with "text" input types
Desired behavior:
Change event should fire with number input just like with text input type
How to reproduce:
https://stackblitz.com/edit/react-byhe3e?file=index.js
App code:
Test code:
Additional Info (images, stack traces, etc):
related issue: #816
test results:
The text was updated successfully, but these errors were encountered: