Skip to content

fix(bug): indeterminate checkbox state doesn't get changed#21665

Merged
BlueWinds merged 6 commits into
cypress-io:developfrom
kshastri:develop
Jun 1, 2022
Merged

fix(bug): indeterminate checkbox state doesn't get changed#21665
BlueWinds merged 6 commits into
cypress-io:developfrom
kshastri:develop

Conversation

@kshastri
Copy link
Copy Markdown
Contributor

@kshastri kshastri commented May 27, 2022

User facing changelog

.check() or .uncheck() will remove the indeterminate state from checkboxes, even if the action is otherwise a noop.

Additional details

using .prop(indeterminate, false) here because as per the removeProp documentation it can lead to unexpected results and it was indeed not working as expected while I tried to use it.

Steps to test

2 tests have been added in check_spec.js

  1. removes indeterminate prop when checkbox is checked
  2. removes indeterminate prop when checkbox is unchecked

How has the user experience changed?

Before
image

After
image

PR Tasks

  • Have tests been added/updated?
  • Has the original issue (or this PR, if no issue exists) been tagged with a release in ZenHub? (user-facing changes only)
  • Has a PR for user-facing changes been opened in cypress-documentation?
  • Have API changes been updated in the type definitions?

@kshastri kshastri requested a review from a team as a code owner May 27, 2022 18:20
@kshastri kshastri requested review from jennifer-shehane and removed request for a team May 27, 2022 18:20
@cypress-bot
Copy link
Copy Markdown
Contributor

cypress-bot Bot commented May 27, 2022

Thanks for taking the time to open a PR!

@jennifer-shehane jennifer-shehane removed their request for review May 27, 2022 18:20
@kshastri kshastri marked this pull request as draft May 27, 2022 19:18
@kshastri kshastri marked this pull request as draft May 27, 2022 19:18
@kshastri kshastri marked this pull request as ready for review May 27, 2022 19:19
@kshastri
Copy link
Copy Markdown
Contributor Author

@chrisbreiding, @BlueWinds - I have resolved the issue. Please have a look when you have time.

@kshastri
Copy link
Copy Markdown
Contributor Author

kshastri commented May 31, 2022

@jennifer-shehane : Could you please get the 6 failing checks in CircleCI checked? The e2e test executed fine in my local for the test cases, I had added. Not sure why these 6 checks are failing.

@BlueWinds BlueWinds self-requested a review May 31, 2022 16:26
if ($el.prop('indeterminate')) {
$el.prop('indeterminate', false)
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So interesting note: cy.uncheck() on an indeterminate checkbox doesn't emit a click event.

At first I thought this was a bug, but the more I think about it, the more it seems like the correct behavior. Users can't uncheck indeterminate checkboxes - clicking on them checks them, which was a case that already worked as expected.

Indeterminate checkboxes are already checked or unchecked, and removing indeterminate on what would otherwise be a no-op is purely a developer QOL feature. There's no browser behavior to emulate, so not emitting any events seems correct.

@BlueWinds
Copy link
Copy Markdown
Contributor

@kshastri - Looks good to me. We're going to hold off merging this until after the 10.0.1 release tomorrow, but should get it in by end of week for 10.0.1.

@kshastri
Copy link
Copy Markdown
Contributor Author

kshastri commented Jun 1, 2022

@kshastri - Looks good to me. We're going to hold off merging this until after the 10.0.1 release tomorrow, but should get it in by end of week for 10.0.1.

This is good to know. Thank you @BlueWinds

@cypress-bot
Copy link
Copy Markdown
Contributor

cypress-bot Bot commented Jun 2, 2022

Released in 10.0.1.

This comment thread has been locked. If you are still experiencing this issue after upgrading to
Cypress v10.0.1, please open a new issue.

@cypress-bot cypress-bot Bot locked as resolved and limited conversation to collaborators Jun 2, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Indeterminate checkbox state doesn't get changed via uncheck({ force: true })

3 participants