close
The Wayback Machine - https://web.archive.org/web/20220311055102/https://github.com/cypress-io/cypress/issues/19098
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

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

Open
sturmery opened this issue Nov 24, 2021 · 2 comments
Open

Comments

@sturmery
Copy link

@sturmery sturmery commented Nov 24, 2021

Current behavior

Cypress does not uncheck checkboxes that have indeterminate state.

Desired behavior

Cypress should detect that it's an indeterminate checkbox, then click on it twice to uncheck.

Test code to reproduce

cy.get("input[aria-label='Toggle Select All Columns']")
  .uncheck({ force: true })

Cypress Version

9.1.0.1027187

Other

https://css-tricks.com/indeterminate-checkboxes/

@chrisbreiding
Copy link
Contributor

@chrisbreiding chrisbreiding commented Dec 2, 2021

I reproduced this with the following code:

index.html

<input type="checkbox" />

spec.js

it('unchecks indeterminate checkbox', () => {
  cy.visit('/index.html')
  cy
  .get('input[type=checkbox]')
  .invoke('prop', 'indeterminate', true)
  .uncheck()
  .should('not.be.checked')
})

After which the checkbox still appears indeterminate. It's worth noting that this is only a visual issue. The above test passes, because the state of the checkbox is correctly changed to unchecked.

I think Cypress could handle this though. On uncheck, we could ensure the indeterminate prop is switched to false. This will be a pretty low priority to fix, but we would welcome a PR for it.

@anthonygedeon
Copy link

@anthonygedeon anthonygedeon commented Dec 12, 2021

I'll like to tackle this if no one else is working on this issue currently.

ElyasAmri pushed a commit to ElyasAmri/cypress that referenced this issue Dec 16, 2021
I'm referring to issue cypress-io#19098 
Basically, it is a simple visual bug fix. Unchecking intermediate checkboxes doesn't remove the intermediate prop.
I neither found the right file for adding the fix nor tested the changes; the repo is huge and I never tried cypress before.
Further support is needed.
ElyasAmri pushed a commit to ElyasAmri/cypress that referenced this issue Dec 16, 2021
I'm referring to this issue cypress-io#19098
Basically, there is a visual bug when unchecking intermediate checkboxes, the intermediate prop does not get removed.
I neither found the right file for the fix nor tested the fix; the repo is huge and I never tried cypress.
Further support is needed.
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