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

When MdCheckbox is initialized to true, the internal native checkbox has checked == false #2001

Closed
pvamshi opened this issue Nov 27, 2016 · 1 comment · Fixed by #2055
Closed
Labels
P2 The issue is important to a large percentage of users, with a workaround

Comments

@pvamshi
Copy link

pvamshi commented Nov 27, 2016

Bug, feature request, or proposal:

Bug

What is the expected behavior?

When the modal value is true, the input we hide should also have the value of true . It gets true when we uncheck and check the checkbox manually.

What is the current behavior?

input element default value is false

What are the steps to reproduce?

https://plnkr.co/edit/SS6LBPL3ucXx1njTRGkF?p=preview

Inspect the checkbox and run this in the console :
$0.querySelector('input').checked // assuming chrome dev environment

What is the use-case or motivation for changing an existing behavior?

Which versions of Angular, Material, OS, browsers are affected?

Angular : 2.2.1
Material: ^ 2.0.0-alpha.10

Is there anything else we should know?

This was a deal breaker while testing the code.
There is another issue , not sure worth creating another bug :
When testing the component using jasmine, the only way to check the checkbox is checked is to look for the class 'md-checkbox-checked' is present. Even this class is not present while testing so there is no way to test if the checkbox is checked when model value is true while rendering.

I could not get the spec working in plnkr, so created a project with the unit tests :
https://github.com/pvamshi/md-checkbox-test

@pvamshi pvamshi changed the title md-checkbox input not true when modal value is true md-checkbox input not true when modal value is true when component loads Nov 27, 2016
@jelbourn jelbourn changed the title md-checkbox input not true when modal value is true when component loads When MdCheckbox is initialized to true, the internal native checkbox has checked == false Nov 30, 2016
@jelbourn jelbourn added the P2 The issue is important to a large percentage of users, with a workaround label Nov 30, 2016
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
P2 The issue is important to a large percentage of users, with a workaround
Projects
None yet
3 participants