Skip to content

update on docs and comments for default option value for checkbox #21230

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

Merged
merged 2 commits into from
Dec 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export class MatCheckboxHarness extends ComponentHarness {
* action is complete.
*
* Note: This attempts to toggle the checkbox as a user would, by clicking it. Therefore if you
* are using `MAT_CHECKBOX_CLICK_ACTION` to change the behavior on click, calling this method
* are using `MAT_CHECKBOX_DEFAULT_OPTIONS` to change the behavior on click, calling this method
* might not have the expected result.
*/
async toggle(): Promise<void> {
Expand All @@ -126,7 +126,7 @@ export class MatCheckboxHarness extends ComponentHarness {
* complete.
*
* Note: This attempts to check the checkbox as a user would, by clicking it. Therefore if you
* are using `MAT_CHECKBOX_CLICK_ACTION` to change the behavior on click, calling this method
* are using `MAT_CHECKBOX_DEFAULT_OPTIONS` to change the behavior on click, calling this method
* might not have the expected result.
*/
async check(): Promise<void> {
Expand All @@ -141,7 +141,7 @@ export class MatCheckboxHarness extends ComponentHarness {
* complete.
*
* Note: This attempts to uncheck the checkbox as a user would, by clicking it. Therefore if you
* are using `MAT_CHECKBOX_CLICK_ACTION` to change the behavior on click, calling this method
* are using `MAT_CHECKBOX_DEFAULT_OPTIONS` to change the behavior on click, calling this method
* might not have the expected result.
*/
async uncheck(): Promise<void> {
Expand Down
4 changes: 2 additions & 2 deletions src/material/checkbox/checkbox.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ remove the indeterminate state.
When user clicks on the `mat-checkbox`, the default behavior is toggle `checked` value and set
`indeterminate` to `false`. This behavior can be customized by
[providing a new value](https://angular.io/guide/dependency-injection)
of `MAT_CHECKBOX_CLICK_ACTION` to the checkbox.
of `MAT_CHECKBOX_DEFAULT_OPTIONS` to the checkbox.

```
providers: [
{provide: MAT_CHECKBOX_CLICK_ACTION, useValue: 'check'}
{provide: MAT_CHECKBOX_DEFAULT_OPTIONS, useValue: { clickAction: 'noop' } as MatCheckboxDefaultOptions}
]
```

Expand Down
6 changes: 3 additions & 3 deletions src/material/checkbox/testing/checkbox-harness.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export class MatCheckboxHarness extends ComponentHarness {
* Toggles the checked state of the checkbox.
*
* Note: This attempts to toggle the checkbox as a user would, by clicking it. Therefore if you
* are using `MAT_CHECKBOX_CLICK_ACTION` to change the behavior on click, calling this method
* are using `MAT_CHECKBOX_DEFAULT_OPTIONS` to change the behavior on click, calling this method
* might not have the expected result.
*/
async toggle(): Promise<void> {
Expand All @@ -122,7 +122,7 @@ export class MatCheckboxHarness extends ComponentHarness {
* nothing if it is already checked.
*
* Note: This attempts to check the checkbox as a user would, by clicking it. Therefore if you
* are using `MAT_CHECKBOX_CLICK_ACTION` to change the behavior on click, calling this method
* are using `MAT_CHECKBOX_DEFAULT_OPTIONS` to change the behavior on click, calling this method
* might not have the expected result.
*/
async check(): Promise<void> {
Expand All @@ -136,7 +136,7 @@ export class MatCheckboxHarness extends ComponentHarness {
* nothing if it is already unchecked.
*
* Note: This attempts to uncheck the checkbox as a user would, by clicking it. Therefore if you
* are using `MAT_CHECKBOX_CLICK_ACTION` to change the behavior on click, calling this method
* are using `MAT_CHECKBOX_DEFAULT_OPTIONS` to change the behavior on click, calling this method
* might not have the expected result.
*/
async uncheck(): Promise<void> {
Expand Down