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

Comments

3 participants
@aciccarello
Copy link

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

This comment has been minimized.

Copy link
Member

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()

@lilaconlee lilaconlee added this to the Sprint 12 milestone Nov 20, 2018

chrisbreiding added a commit that referenced this issue Nov 20, 2018

Add clear support for HTML 5 input types (#2793)
- Fixes #2738 

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

This comment has been minimized.

Copy link
Contributor

lilaconlee commented Nov 20, 2018

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

@aciccarello

This comment has been minimized.

Copy link
Author

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.

@jennifer-shehane

This comment has been minimized.

Copy link
Member

jennifer-shehane commented Mar 6, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.