@@ -89,6 +89,13 @@ describe('MatDateRangeInput', () => {
8989 expect ( fixture . componentInstance . end . nativeElement . getAttribute ( 'type' ) ) . toBe ( 'text' ) ;
9090 } ) ;
9191
92+ it ( 'should set the correct role on the range input' , ( ) => {
93+ const fixture = createComponent ( StandardRangePicker ) ;
94+ fixture . detectChanges ( ) ;
95+ const rangeInput = fixture . nativeElement . querySelector ( '.mat-date-range-input' ) ;
96+ expect ( rangeInput . getAttribute ( 'role' ) ) . toBe ( 'group' ) ;
97+ } ) ;
98+
9299 it ( 'should mark the entire range input as disabled if both inputs are disabled' , ( ) => {
93100 const fixture = createComponent ( StandardRangePicker ) ;
94101 fixture . detectChanges ( ) ;
@@ -151,26 +158,24 @@ describe('MatDateRangeInput', () => {
151158 expect ( label . getAttribute ( 'aria-owns' ) ) . toBe ( start . id ) ;
152159 } ) ;
153160
154- it ( 'should point the input aria-labelledby to the form field label' , ( ) => {
161+ it ( 'should point the range input aria-labelledby to the form field label' , ( ) => {
155162 const fixture = createComponent ( StandardRangePicker ) ;
156163 fixture . detectChanges ( ) ;
157164 const labelId = fixture . nativeElement . querySelector ( 'label' ) . id ;
158- const { start , end } = fixture . componentInstance ;
165+ const rangeInput = fixture . nativeElement . querySelector ( '.mat-date-range-input' ) ;
159166
160167 expect ( labelId ) . toBeTruthy ( ) ;
161- expect ( start . nativeElement . getAttribute ( 'aria-labelledby' ) ) . toBe ( labelId ) ;
162- expect ( end . nativeElement . getAttribute ( 'aria-labelledby' ) ) . toBe ( labelId ) ;
168+ expect ( rangeInput . getAttribute ( 'aria-labelledby' ) ) . toBe ( labelId ) ;
163169 } ) ;
164170
165- it ( 'should point the input aria-labelledby to the form field hint element' , ( ) => {
171+ it ( 'should point the range input aria-labelledby to the form field hint element' , ( ) => {
166172 const fixture = createComponent ( StandardRangePicker ) ;
167173 fixture . detectChanges ( ) ;
168174 const labelId = fixture . nativeElement . querySelector ( '.mat-hint' ) . id ;
169- const { start , end } = fixture . componentInstance ;
175+ const rangeInput = fixture . nativeElement . querySelector ( '.mat-date-range-input' ) ;
170176
171177 expect ( labelId ) . toBeTruthy ( ) ;
172- expect ( start . nativeElement . getAttribute ( 'aria-describedby' ) ) . toBe ( labelId ) ;
173- expect ( end . nativeElement . getAttribute ( 'aria-describedby' ) ) . toBe ( labelId ) ;
178+ expect ( rangeInput . getAttribute ( 'aria-describedby' ) ) . toBe ( labelId ) ;
174179 } ) ;
175180
176181 it ( 'should float the form field label when either input is focused' , ( ) => {
0 commit comments