Skip to content

Commit 438f3ee

Browse files
committed
re-enable checkbox before toggle test
1 parent df04538 commit 438f3ee

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

src/material-experimental/mdc-checkbox/harness/checkbox-harness.spec.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {MatCheckboxModule as MatMdcCheckboxModule} from '../index';
88
import {MatCheckboxHarness} from './checkbox-harness';
99
import {MatCheckboxHarness as MatMdcCheckboxHarness} from './mdc-checkbox-harness';
1010

11-
let fixture: ComponentFixture<unknown>;
11+
let fixture: ComponentFixture<CheckboxHarnessTest>;
1212
let loader: HarnessLoader;
1313
let checkboxHarness: typeof MatCheckboxHarness;
1414

@@ -141,6 +141,7 @@ function runTests() {
141141
});
142142

143143
it('should toggle checkbox', async () => {
144+
fixture.componentInstance.disabled = false;
144145
const checkboxes = await loader.getAllHarnesses(checkboxHarness);
145146
await checkboxes[0].toggle();
146147
await checkboxes[1].toggle();
@@ -149,6 +150,7 @@ function runTests() {
149150
});
150151

151152
it('should check checkbox', async () => {
153+
fixture.componentInstance.disabled = false;
152154
const checkboxes = await loader.getAllHarnesses(checkboxHarness);
153155
await checkboxes[0].check();
154156
await checkboxes[1].check();
@@ -157,6 +159,7 @@ function runTests() {
157159
});
158160

159161
it('should uncheck checkbox', async () => {
162+
fixture.componentInstance.disabled = false;
160163
const checkboxes = await loader.getAllHarnesses(checkboxHarness);
161164
await checkboxes[0].uncheck();
162165
await checkboxes[1].uncheck();
@@ -179,13 +182,14 @@ function getActiveElementTagName() {
179182
aria-label="First checkbox">
180183
First
181184
</mat-checkbox>
182-
<mat-checkbox indeterminate="true" disabled="true" aria-labelledby="second-label">
185+
<mat-checkbox indeterminate="true" [disabled]="disabled" aria-labelledby="second-label">
183186
Second
184187
</mat-checkbox>
185188
<span id="second-label">Second checkbox</span>
186189
`
187190
})
188191
class CheckboxHarnessTest {
189192
ctrl = new FormControl(true);
193+
disabled = true;
190194
}
191195

src/material-experimental/mdc-checkbox/harness/checkbox-harness.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ export class MatCheckboxHarness extends ComponentHarness {
3030

3131
private _label = this.locatorFor('.mat-checkbox-label');
3232
private _input = this.locatorFor('input');
33+
private _inputContainer = this.locatorFor('.mat-checkbox-inner-container');
3334

3435
/** Gets a boolean promise indicating if the checkbox is checked. */
3536
async isChecked(): Promise<boolean> {
@@ -101,7 +102,7 @@ export class MatCheckboxHarness extends ComponentHarness {
101102
* action is complete.
102103
*/
103104
async toggle(): Promise<void> {
104-
return (await this._input()).click();
105+
return (await this._inputContainer()).click();
105106
}
106107

107108
/**

0 commit comments

Comments
 (0)