-
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
Digits Scrambled when using type on tel input field with input mask #940
Comments
Can confirm, fails in v1.1.1. To replicate: Test code it('Type in tel input with input mask', function(){
cy.visit('http://robinherbots.github.io/Inputmask/')
cy.contains('Demo').click()
cy.get('input[data-inputmask-alias]').first()
.type('11212017')
.should('have.value', '11/21/2017')
}) |
Also doesn't works with text-mask. |
Typing the complete value works with text-mask. For example I have a mask for times like: |
I have something similar Steps to reproduce Run this on localhost:8000 <html>
<head>
</head>
<body>
<input id="billingZip" name="zip" type="tel" value="55344" placeholder="" maxlength="5" data-track-id="" class="sessioncamhidetext form-control ">
</body>
</html> Run the following tests Test code:it('Not Working Example', () => {
cy.visit('localhost:8000')
cy.get('#billingZip').clear().type('54321')
});
it('Workaround Example', () => {
cy.visit('localhost:8000')
cy.get('#billingZip').invoke('attr', 'maxlength', '10').clear().type('54321')
}); |
@JPHamlett1993 actually after looking at your code I think you're referring to a bug in Update to that and it should work. https://docs.cypress.io/guides/references/changelog.html#1-1-2 |
@brian-mann I am on 1.1.2 |
@JPHamlett1993 I confirmed your issue. I think it's a separate one from this. It's another edge case around the |
@brian-mann Why does Cypress look at max-length, why shouldn't the application handle that? |
Because |
I have an element as follows: |
sorry, as follows: |
There's workaround that might be helpful to people who have the same issue. updateIt seems that this won't actually change the input value when it lost focus. I've tried sth like |
@paulbao Extending on your workaround, I found that overriding the value worked great, but I still needed to call .type() to trigger an onChange event. So I chose to simulate clear() by emptying the input value, then typing in the new value I wanted: cy.get('#UserInfoDialog input')
.then($input => $input.val(''))
.type('123')
.should('have.value', '123') |
I'm currently working on this. An upcoming patch release should fix this issue - this should be true for many |
Is this a Feature or Bug?
Bug
Current behavior:
When using .type() on tel inputs with masks, the numbers are entered out of order. That is, digits are added to the end of the field when they meet a special character.
Desired behavior:
The digits are entered into the field in order.
How to reproduce:
Call .type() on a tel input field with an input mask that provides hyphens, parentheses, or other formatting
Test code:
Additional Info (images, stack traces, etc)
The text was updated successfully, but these errors were encountered: