@@ -444,6 +444,28 @@ describe('MDC-based MatCheckbox', () => {
444444 expect ( checkboxNativeElement . querySelector ( 'svg' ) ! . getAttribute ( 'focusable' ) ) . toBe ( 'false' ) ;
445445 } ) ) ;
446446
447+ it ( 'should be able to mark a checkbox as disabled while keeping it interactive' , fakeAsync ( ( ) => {
448+ testComponent . isDisabled = true ;
449+ fixture . changeDetectorRef . markForCheck ( ) ;
450+ fixture . detectChanges ( ) ;
451+
452+ expect ( checkboxNativeElement . classList ) . not . toContain (
453+ 'mat-mdc-checkbox-disabled-interactive' ,
454+ ) ;
455+ expect ( inputElement . hasAttribute ( 'aria-disabled' ) ) . toBe ( false ) ;
456+ expect ( inputElement . tabIndex ) . toBe ( - 1 ) ;
457+ expect ( inputElement . disabled ) . toBe ( true ) ;
458+
459+ testComponent . disabledInteractive = true ;
460+ fixture . changeDetectorRef . markForCheck ( ) ;
461+ fixture . detectChanges ( ) ;
462+
463+ expect ( checkboxNativeElement . classList ) . toContain ( 'mat-mdc-checkbox-disabled-interactive' ) ;
464+ expect ( inputElement . getAttribute ( 'aria-disabled' ) ) . toBe ( 'true' ) ;
465+ expect ( inputElement . tabIndex ) . toBe ( 0 ) ;
466+ expect ( inputElement . disabled ) . toBe ( false ) ;
467+ } ) ) ;
468+
447469 describe ( 'ripple elements' , ( ) => {
448470 it ( 'should show ripples on label mousedown' , fakeAsync ( ( ) => {
449471 const rippleSelector = '.mat-ripple-element:not(.mat-checkbox-persistent-ripple)' ;
@@ -1111,6 +1133,7 @@ describe('MatCheckboxDefaultOptions', () => {
11111133 [color]="checkboxColor"
11121134 [disableRipple]="disableRipple"
11131135 [value]="checkboxValue"
1136+ [disabledInteractive]="disabledInteractive"
11141137 (change)="onCheckboxChange($event)">
11151138 Simple checkbox
11161139 </mat-checkbox>
@@ -1120,13 +1143,14 @@ describe('MatCheckboxDefaultOptions', () => {
11201143} )
11211144class SingleCheckbox {
11221145 labelPos : 'before' | 'after' = 'after' ;
1123- isChecked : boolean = false ;
1124- isRequired : boolean = false ;
1125- isIndeterminate : boolean = false ;
1126- isDisabled : boolean = false ;
1127- disableRipple : boolean = false ;
1128- parentElementClicked : boolean = false ;
1129- parentElementKeyedUp : boolean = false ;
1146+ isChecked = false ;
1147+ isRequired = false ;
1148+ isIndeterminate = false ;
1149+ isDisabled = false ;
1150+ disableRipple = false ;
1151+ parentElementClicked = false ;
1152+ parentElementKeyedUp = false ;
1153+ disabledInteractive = false ;
11301154 checkboxId : string | null = 'simple-check' ;
11311155 checkboxColor : ThemePalette = 'primary' ;
11321156 checkboxValue : string = 'single_checkbox' ;
@@ -1143,9 +1167,9 @@ class SingleCheckbox {
11431167 imports : [ MatCheckbox , FormsModule ] ,
11441168} )
11451169class CheckboxWithNgModel {
1146- isGood : boolean = false ;
1147- isRequired : boolean = true ;
1148- isDisabled : boolean = false ;
1170+ isGood = false ;
1171+ isRequired = true ;
1172+ isDisabled = false ;
11491173}
11501174
11511175@Component ( {
0 commit comments