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

Support .clear() on date inputs #2738

Closed
aciccarello opened this issue Nov 7, 2018 · 4 comments
Closed

Support .clear() on date inputs #2738

aciccarello opened this issue Nov 7, 2018 · 4 comments
Assignees
Milestone

Comments

@aciccarello
Copy link

@aciccarello aciccarello commented Nov 7, 2018

Using .clear() on a date field should clear the value rather than causing an error. This may affect other field types.

Related StackOverflow question

Current behavior:

The .clear() command is an alias for .type({selectall}{backspace}). However, typing in date fields is limited to strings matching the date format. This causes Cypress to throw an error.

CypressError: Typing into a date input with cy.type() requires a valid date with the format 'yyyy-MM-dd'. You passed: {selectall}{del}

Desired behavior:

The type command should allow {selectall}{del} for date inputs and clear the input value.

Versions

Tested on Cypress 3.1.0

@jennifer-shehane
Copy link
Member

@jennifer-shehane jennifer-shehane commented Nov 14, 2018

Have confirmed, this does error when trying to clear a date field and it should not error.

    cy.get('input').type('2019-08-07')
    cy.get('input').clear()

Loading

@lilaconlee lilaconlee added this to the Sprint 12 milestone Nov 20, 2018
chrisbreiding added a commit that referenced this issue Nov 20, 2018
- Fixes #2738 

Think directly setting this value might overstep something that's happening in type, but not entirely sure.
@lilaconlee
Copy link
Contributor

@lilaconlee lilaconlee commented Nov 20, 2018

This has been fixed and we'll update the issue and the changelog when it's released.

Loading

@aciccarello
Copy link
Author

@aciccarello aciccarello commented Mar 5, 2019

@lilaconlee Look like this was released in 3.1.5 however I don't see that noted in the changelog.

Loading

@jennifer-shehane
Copy link
Member

@jennifer-shehane jennifer-shehane commented Mar 6, 2019

Thanks @aciccarello, this was released in 3.1.5. The changelog has been updated to reflect this.

Loading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants