@@ -141,6 +141,49 @@ describe('MatProgressBar', () => {
141
141
142
142
expect ( rect . getAttribute ( 'fill' ) ) . toMatch ( / ^ u r l \( [ ' " ] ? \/ a n o t h e r - f a k e - p a t h # .* [ ' " ] ? \) $ / ) ;
143
143
} ) ;
144
+
145
+ it ( 'should remove the `aria-valuenow` attribute in indeterminate mode' , ( ) => {
146
+ const fixture = createComponent ( BasicProgressBar ) ;
147
+ fixture . detectChanges ( ) ;
148
+
149
+ const progressElement = fixture . debugElement . query ( By . css ( 'mat-progress-bar' ) ) ;
150
+ const progressComponent = progressElement . componentInstance ;
151
+
152
+ progressComponent . mode = 'determinate' ;
153
+ progressComponent . value = 50 ;
154
+ fixture . detectChanges ( ) ;
155
+
156
+ expect ( progressElement . nativeElement . getAttribute ( 'aria-valuenow' ) )
157
+ . toBe ( '50' , 'Expected aria-valuenow to be set in determinate mode.' ) ;
158
+
159
+ progressComponent . mode = 'indeterminate' ;
160
+ fixture . detectChanges ( ) ;
161
+
162
+ expect ( progressElement . nativeElement . hasAttribute ( 'aria-valuenow' ) )
163
+ . toBe ( false , 'Expect aria-valuenow to be cleared in indeterminate mode.' ) ;
164
+ } ) ;
165
+
166
+ it ( 'should remove the `aria-valuenow` attribute in query mode' , ( ) => {
167
+ const fixture = createComponent ( BasicProgressBar ) ;
168
+ fixture . detectChanges ( ) ;
169
+
170
+ const progressElement = fixture . debugElement . query ( By . css ( 'mat-progress-bar' ) ) ;
171
+ const progressComponent = progressElement . componentInstance ;
172
+
173
+ progressComponent . mode = 'determinate' ;
174
+ progressComponent . value = 50 ;
175
+ fixture . detectChanges ( ) ;
176
+
177
+ expect ( progressElement . nativeElement . getAttribute ( 'aria-valuenow' ) )
178
+ . toBe ( '50' , 'Expected aria-valuenow to be set in determinate mode.' ) ;
179
+
180
+ progressComponent . mode = 'query' ;
181
+ fixture . detectChanges ( ) ;
182
+
183
+ expect ( progressElement . nativeElement . hasAttribute ( 'aria-valuenow' ) )
184
+ . toBe ( false , 'Expect aria-valuenow to be cleared in query mode.' ) ;
185
+ } ) ;
186
+
144
187
} ) ;
145
188
146
189
describe ( 'animation trigger on determinate setting' , ( ) => {
0 commit comments