@@ -405,13 +405,15 @@ describe('MatButton', () => {
405405 describe ( 'interactive disabled buttons' , ( ) => {
406406 let fixture : ComponentFixture < TestApp > ;
407407 let button : HTMLButtonElement ;
408+ let anchor : HTMLAnchorElement ;
408409
409410 beforeEach ( ( ) => {
410411 fixture = TestBed . createComponent ( TestApp ) ;
411412 fixture . componentInstance . isDisabled = true ;
412413 fixture . changeDetectorRef . markForCheck ( ) ;
413414 fixture . detectChanges ( ) ;
414- button = fixture . debugElement . query ( By . css ( 'button' ) ) ! . nativeElement ;
415+ button = fixture . nativeElement . querySelector ( 'button' ) ;
416+ anchor = fixture . nativeElement . querySelector ( 'a' ) ;
415417 } ) ;
416418
417419 it ( 'should set a class when allowing disabled interactivity' , ( ) => {
@@ -443,6 +445,29 @@ describe('MatButton', () => {
443445
444446 expect ( button . hasAttribute ( 'disabled' ) ) . toBe ( false ) ;
445447 } ) ;
448+
449+ it ( 'should set aria-disabled on anchor when disabledInteractive is enabled' , ( ) => {
450+ fixture . componentInstance . isDisabled = false ;
451+ fixture . changeDetectorRef . markForCheck ( ) ;
452+ fixture . detectChanges ( ) ;
453+ expect ( anchor . hasAttribute ( 'aria-disabled' ) ) . toBe ( false ) ;
454+ expect ( anchor . hasAttribute ( 'disabled' ) ) . toBe ( false ) ;
455+ expect ( anchor . classList ) . not . toContain ( 'mat-mdc-button-disabled-interactive' ) ;
456+
457+ fixture . componentInstance . isDisabled = true ;
458+ fixture . changeDetectorRef . markForCheck ( ) ;
459+ fixture . detectChanges ( ) ;
460+ expect ( anchor . getAttribute ( 'aria-disabled' ) ) . toBe ( 'true' ) ;
461+ expect ( anchor . hasAttribute ( 'disabled' ) ) . toBe ( true ) ;
462+ expect ( anchor . classList ) . not . toContain ( 'mat-mdc-button-disabled-interactive' ) ;
463+
464+ fixture . componentInstance . disabledInteractive = true ;
465+ fixture . changeDetectorRef . markForCheck ( ) ;
466+ fixture . detectChanges ( ) ;
467+ expect ( anchor . getAttribute ( 'aria-disabled' ) ) . toBe ( 'true' ) ;
468+ expect ( anchor . hasAttribute ( 'disabled' ) ) . toBe ( false ) ;
469+ expect ( anchor . classList ) . toContain ( 'mat-mdc-button-disabled-interactive' ) ;
470+ } ) ;
446471 } ) ;
447472} ) ;
448473
0 commit comments