@@ -12,14 +12,13 @@ import {CheckboxHarnessFilters} from './checkbox-harness-filters';
1212
1313/** Harness for interacting with a standard mat-checkbox in tests. */
1414export class MatCheckboxHarness extends ComponentHarness {
15+ /** The selector for the host element of a `MatCheckbox` instance. */
1516 static hostSelector = 'mat-checkbox' ;
1617
1718 /**
18- * Gets a `HarnessPredicate` that can be used to search for a checkbox with specific attributes.
19- * @param options Options for narrowing the search:
20- * - `selector` finds a checkbox whose host element matches the given selector.
21- * - `label` finds a checkbox with specific label text.
22- * - `name` finds a checkbox with specific name.
19+ * Gets a `HarnessPredicate` that can be used to search for a `MatCheckboxHarness` that meets
20+ * certain criteria.
21+ * @param options Options for filtering which checkbox instances are considered a match.
2322 * @return a `HarnessPredicate` configured with the given options.
2423 */
2524 static with ( options : CheckboxHarnessFilters = { } ) : HarnessPredicate < MatCheckboxHarness > {
@@ -37,74 +36,73 @@ export class MatCheckboxHarness extends ComponentHarness {
3736 private _input = this . locatorFor ( 'input' ) ;
3837 private _inputContainer = this . locatorFor ( '.mat-checkbox-inner-container' ) ;
3938
40- /** Gets a boolean promise indicating if the checkbox is checked. */
39+ /** Whether the checkbox is checked. */
4140 async isChecked ( ) : Promise < boolean > {
4241 const checked = ( await this . _input ( ) ) . getProperty ( 'checked' ) ;
4342 return coerceBooleanProperty ( await checked ) ;
4443 }
4544
46- /** Gets a boolean promise indicating if the checkbox is in an indeterminate state. */
45+ /** Whether the checkbox is in an indeterminate state. */
4746 async isIndeterminate ( ) : Promise < boolean > {
4847 const indeterminate = ( await this . _input ( ) ) . getProperty ( 'indeterminate' ) ;
4948 return coerceBooleanProperty ( await indeterminate ) ;
5049 }
5150
52- /** Gets a boolean promise indicating if the checkbox is disabled. */
51+ /** Whether the checkbox is disabled. */
5352 async isDisabled ( ) : Promise < boolean > {
5453 const disabled = ( await this . _input ( ) ) . getAttribute ( 'disabled' ) ;
5554 return coerceBooleanProperty ( await disabled ) ;
5655 }
5756
58- /** Gets a boolean promise indicating if the checkbox is required. */
57+ /** Whether the checkbox is required. */
5958 async isRequired ( ) : Promise < boolean > {
6059 const required = ( await this . _input ( ) ) . getProperty ( 'required' ) ;
6160 return coerceBooleanProperty ( await required ) ;
6261 }
6362
64- /** Gets a boolean promise indicating if the checkbox is valid. */
63+ /** Whether the checkbox is valid. */
6564 async isValid ( ) : Promise < boolean > {
6665 const invalid = ( await this . host ( ) ) . hasClass ( 'ng-invalid' ) ;
6766 return ! ( await invalid ) ;
6867 }
6968
70- /** Gets a promise for the checkbox's name. */
69+ /** Gets the checkbox's name. */
7170 async getName ( ) : Promise < string | null > {
7271 return ( await this . _input ( ) ) . getAttribute ( 'name' ) ;
7372 }
7473
75- /** Gets a promise for the checkbox's value. */
74+ /** Gets the checkbox's value. */
7675 async getValue ( ) : Promise < string | null > {
7776 return ( await this . _input ( ) ) . getProperty ( 'value' ) ;
7877 }
7978
80- /** Gets a promise for the checkbox's aria-label. */
79+ /** Gets the checkbox's aria-label. */
8180 async getAriaLabel ( ) : Promise < string | null > {
8281 return ( await this . _input ( ) ) . getAttribute ( 'aria-label' ) ;
8382 }
8483
85- /** Gets a promise for the checkbox's aria-labelledby. */
84+ /** Gets the checkbox's aria-labelledby. */
8685 async getAriaLabelledby ( ) : Promise < string | null > {
8786 return ( await this . _input ( ) ) . getAttribute ( 'aria-labelledby' ) ;
8887 }
8988
90- /** Gets a promise for the checkbox's label text. */
89+ /** Gets the checkbox's label text. */
9190 async getLabelText ( ) : Promise < string > {
9291 return ( await this . _label ( ) ) . text ( ) ;
9392 }
9493
95- /** Focuses the checkbox and returns a void promise that indicates when the action is complete . */
94+ /** Focuses the checkbox. */
9695 async focus ( ) : Promise < void > {
9796 return ( await this . _input ( ) ) . focus ( ) ;
9897 }
9998
100- /** Blurs the checkbox and returns a void promise that indicates when the action is complete . */
99+ /** Blurs the checkbox. */
101100 async blur ( ) : Promise < void > {
102101 return ( await this . _input ( ) ) . blur ( ) ;
103102 }
104103
105104 /**
106- * Toggle the checked state of the checkbox and returns a void promise that indicates when the
107- * action is complete.
105+ * Toggles the checked state of the checkbox.
108106 *
109107 * Note: This attempts to toggle the checkbox as a user would, by clicking it. Therefore if you
110108 * are using `MAT_CHECKBOX_CLICK_ACTION` to change the behavior on click, calling this method
@@ -116,8 +114,7 @@ export class MatCheckboxHarness extends ComponentHarness {
116114
117115 /**
118116 * Puts the checkbox in a checked state by toggling it if it is currently unchecked, or doing
119- * nothing if it is already checked. Returns a void promise that indicates when the action is
120- * complete.
117+ * nothing if it is already checked.
121118 *
122119 * Note: This attempts to check the checkbox as a user would, by clicking it. Therefore if you
123120 * are using `MAT_CHECKBOX_CLICK_ACTION` to change the behavior on click, calling this method
@@ -131,8 +128,7 @@ export class MatCheckboxHarness extends ComponentHarness {
131128
132129 /**
133130 * Puts the checkbox in an unchecked state by toggling it if it is currently checked, or doing
134- * nothing if it is already unchecked. Returns a void promise that indicates when the action is
135- * complete.
131+ * nothing if it is already unchecked.
136132 *
137133 * Note: This attempts to uncheck the checkbox as a user would, by clicking it. Therefore if you
138134 * are using `MAT_CHECKBOX_CLICK_ACTION` to change the behavior on click, calling this method
0 commit comments