@@ -816,8 +816,12 @@ describe('MatRadio', () => {
816816 testComponent . ariaLabel = 'Pineapple' ;
817817 fixture . changeDetectorRef . markForCheck ( ) ;
818818 fixture . detectChanges ( ) ;
819-
820819 expect ( fruitRadioNativeInputs [ 0 ] . getAttribute ( 'aria-label' ) ) . toBe ( 'Pineapple' ) ;
820+
821+ testComponent . ariaLabel = null ;
822+ fixture . changeDetectorRef . markForCheck ( ) ;
823+ fixture . detectChanges ( ) ;
824+ expect ( fruitRadioNativeInputs [ 0 ] . hasAttribute ( 'aria-label' ) ) . toBe ( false ) ;
821825 } ) ;
822826
823827 it ( 'should add aria-labelledby attribute to the underlying input element if defined' , ( ) => {
@@ -834,8 +838,12 @@ describe('MatRadio', () => {
834838 testComponent . ariaLabelledby = 'uvw' ;
835839 fixture . changeDetectorRef . markForCheck ( ) ;
836840 fixture . detectChanges ( ) ;
837-
838841 expect ( fruitRadioNativeInputs [ 0 ] . getAttribute ( 'aria-labelledby' ) ) . toBe ( 'uvw' ) ;
842+
843+ testComponent . ariaLabelledby = null ;
844+ fixture . changeDetectorRef . markForCheck ( ) ;
845+ fixture . detectChanges ( ) ;
846+ expect ( fruitRadioNativeInputs [ 0 ] . hasAttribute ( 'aria-labelledby' ) ) . toBe ( false ) ;
839847 } ) ;
840848
841849 it ( 'should add aria-describedby attribute to the underlying input element if defined' , ( ) => {
@@ -852,8 +860,12 @@ describe('MatRadio', () => {
852860 testComponent . ariaDescribedby = 'uvw' ;
853861 fixture . changeDetectorRef . markForCheck ( ) ;
854862 fixture . detectChanges ( ) ;
855-
856863 expect ( fruitRadioNativeInputs [ 0 ] . getAttribute ( 'aria-describedby' ) ) . toBe ( 'uvw' ) ;
864+
865+ testComponent . ariaDescribedby = null ;
866+ fixture . changeDetectorRef . markForCheck ( ) ;
867+ fixture . detectChanges ( ) ;
868+ expect ( fruitRadioNativeInputs [ 0 ] . hasAttribute ( 'aria-describedby' ) ) . toBe ( false ) ;
857869 } ) ;
858870
859871 it ( 'should focus on underlying input element when focus() is called' , ( ) => {
@@ -1117,9 +1129,9 @@ class RadiosInsidePreCheckedRadioGroup {}
11171129 imports : [ MatRadioModule , FormsModule , ReactiveFormsModule ] ,
11181130} )
11191131class StandaloneRadioButtons {
1120- ariaLabel : string = 'Banana' ;
1121- ariaLabelledby : string = 'xyz' ;
1122- ariaDescribedby : string = 'abc' ;
1132+ ariaLabel : string | null = 'Banana' ;
1133+ ariaLabelledby : string | null = 'xyz' ;
1134+ ariaDescribedby : string | null = 'abc' ;
11231135}
11241136
11251137@Component ( {
0 commit comments