fix(bug): indeterminate checkbox state doesn't get changed#21665
Conversation
|
Thanks for taking the time to open a PR!
|
|
@chrisbreiding, @BlueWinds - I have resolved the issue. Please have a look when you have time. |
|
@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. |
| if ($el.prop('indeterminate')) { | ||
| $el.prop('indeterminate', false) | ||
| } | ||
|
|
There was a problem hiding this comment.
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.
|
@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 |
|
Released in This comment thread has been locked. If you are still experiencing this issue after upgrading to |
User facing changelog
.check()or.uncheck()will remove theindeterminatestate 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
How has the user experience changed?
Before

After

PR Tasks
cypress-documentation?type definitions?