Skip to content
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

cy.type() on input[type='number'] prepends text to current value instead of appending #26

Closed
jennifer-shehane opened this issue Apr 20, 2015 · 2 comments
Labels
type: unexpected behavior User expected result, but got another

Comments

@jennifer-shehane
Copy link
Member

When I use the command cy.type() on a DOM element of input[type='number'] the text entered prepends to any existing value in the input instead of appending (as cy.type() does on input[type='text'] and textarea.

Example

<input name="height" type="number" value="25">
cy.get("input[name='height']").type("167").should("have.value", "25167")

This example's assertion will fail and say expected input to have value of '25167', but got '16725'

@jennifer-shehane jennifer-shehane added type: bug type: unexpected behavior User expected result, but got another and removed type: bug labels Apr 20, 2015
@brian-mann
Copy link
Member

This will be fixed in the next release. input[type=number] does not support el.selectionStart (the caret) which is why this was happening.

@brian-mann
Copy link
Member

brian-mann commented Jun 26, 2015

Fixed in 0.8.0

@cypress-io cypress-io locked as resolved and limited conversation to collaborators Dec 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: unexpected behavior User expected result, but got another
Projects
None yet
Development

No branches or pull requests

2 participants