@@ -89,6 +89,13 @@ describe('MatDateRangeInput', () => {
89
89
expect ( fixture . componentInstance . end . nativeElement . getAttribute ( 'type' ) ) . toBe ( 'text' ) ;
90
90
} ) ;
91
91
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
+
92
99
it ( 'should mark the entire range input as disabled if both inputs are disabled' , ( ) => {
93
100
const fixture = createComponent ( StandardRangePicker ) ;
94
101
fixture . detectChanges ( ) ;
@@ -151,26 +158,24 @@ describe('MatDateRangeInput', () => {
151
158
expect ( label . getAttribute ( 'aria-owns' ) ) . toBe ( start . id ) ;
152
159
} ) ;
153
160
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' , ( ) => {
155
162
const fixture = createComponent ( StandardRangePicker ) ;
156
163
fixture . detectChanges ( ) ;
157
164
const labelId = fixture . nativeElement . querySelector ( 'label' ) . id ;
158
- const { start , end } = fixture . componentInstance ;
165
+ const rangeInput = fixture . nativeElement . querySelector ( '.mat-date-range-input' ) ;
159
166
160
167
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 ) ;
163
169
} ) ;
164
170
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' , ( ) => {
166
172
const fixture = createComponent ( StandardRangePicker ) ;
167
173
fixture . detectChanges ( ) ;
168
174
const labelId = fixture . nativeElement . querySelector ( '.mat-hint' ) . id ;
169
- const { start , end } = fixture . componentInstance ;
175
+ const rangeInput = fixture . nativeElement . querySelector ( '.mat-date-range-input' ) ;
170
176
171
177
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 ) ;
174
179
} ) ;
175
180
176
181
it ( 'should float the form field label when either input is focused' , ( ) => {
0 commit comments