File tree Expand file tree Collapse file tree 4 files changed +18
-0
lines changed
material-experimental/mdc-radio Expand file tree Collapse file tree 4 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -79,6 +79,11 @@ describe('MDC-based MatRadio', () => {
79
79
}
80
80
} ) ;
81
81
82
+ it ( 'should clear the name attribute from the radio group host node' , ( ) => {
83
+ expect ( groupInstance . name ) . toBeTruthy ( ) ;
84
+ expect ( groupDebugElement . nativeElement . getAttribute ( 'name' ) ) . toBeFalsy ( ) ;
85
+ } ) ;
86
+
82
87
it ( 'should coerce the disabled binding on the radio group' , ( ) => {
83
88
( groupInstance as any ) . disabled = '' ;
84
89
fixture . detectChanges ( ) ;
Original file line number Diff line number Diff line change @@ -72,6 +72,7 @@ export const MAT_RADIO_GROUP = new InjectionToken<_MatRadioGroupBase<_MatRadioBu
72
72
host : {
73
73
'role' : 'radiogroup' ,
74
74
'class' : 'mat-mdc-radio-group' ,
75
+ '[attr.name]' : 'null' ,
75
76
} ,
76
77
} )
77
78
export class MatRadioGroup extends _MatRadioGroupBase < MatRadioButton > {
@@ -96,6 +97,7 @@ export class MatRadioGroup extends _MatRadioGroupBase<MatRadioButton> {
96
97
'[attr.aria-label]' : 'null' ,
97
98
'[attr.aria-labelledby]' : 'null' ,
98
99
'[attr.aria-describedby]' : 'null' ,
100
+ '[attr.name]' : 'null' ,
99
101
// Note: under normal conditions focus shouldn't land on this element, however it may be
100
102
// programmatically set, for example inside of a focus trap, in this case we want to forward
101
103
// the focus to the native element.
Original file line number Diff line number Diff line change @@ -71,6 +71,11 @@ describe('MatRadio', () => {
71
71
}
72
72
} ) ;
73
73
74
+ it ( 'should clear the name attribute from the radio group host node' , ( ) => {
75
+ expect ( groupInstance . name ) . toBeTruthy ( ) ;
76
+ expect ( groupDebugElement . nativeElement . getAttribute ( 'name' ) ) . toBeFalsy ( ) ;
77
+ } ) ;
78
+
74
79
it ( 'should coerce the disabled binding on the radio group' , ( ) => {
75
80
( groupInstance as any ) . disabled = '' ;
76
81
fixture . detectChanges ( ) ;
@@ -781,6 +786,10 @@ describe('MatRadio', () => {
781
786
it ( 'should default the radio color to `accent`' , ( ) => {
782
787
expect ( seasonRadioInstances . every ( radio => radio . color === 'accent' ) ) . toBe ( true ) ;
783
788
} ) ;
789
+
790
+ it ( 'should clear the name attribute from the radio host node' , ( ) => {
791
+ expect ( radioDebugElements . every ( el => ! el . nativeElement . getAttribute ( 'name' ) ) ) . toBe ( true ) ;
792
+ } ) ;
784
793
} ) ;
785
794
786
795
describe ( 'with tabindex' , ( ) => {
Original file line number Diff line number Diff line change @@ -335,6 +335,7 @@ export abstract class _MatRadioGroupBase<T extends _MatRadioButtonBase>
335
335
host : {
336
336
'role' : 'radiogroup' ,
337
337
'class' : 'mat-radio-group' ,
338
+ '[attr.name]' : 'null' ,
338
339
} ,
339
340
} )
340
341
export class MatRadioGroup extends _MatRadioGroupBase < MatRadioButton > {
@@ -655,6 +656,7 @@ export abstract class _MatRadioButtonBase
655
656
'[attr.aria-label]' : 'null' ,
656
657
'[attr.aria-labelledby]' : 'null' ,
657
658
'[attr.aria-describedby]' : 'null' ,
659
+ '[attr.name]' : 'null' ,
658
660
// Note: under normal conditions focus shouldn't land on this element, however it may be
659
661
// programmatically set, for example inside of a focus trap, in this case we want to forward
660
662
// the focus to the native element.
You can’t perform that action at this time.
0 commit comments