@@ -8,16 +8,18 @@ import {MatProgressBar} from './progress-bar';
88
99
1010describe ( 'MatProgressBar' , ( ) => {
11- let fakePath = '/fake-path' ;
11+ let fakePath : string ;
1212
1313 function createComponent < T > ( componentType : Type < T > ,
1414 imports ?: Array < Type < { } > > ) : ComponentFixture < T > {
15+ fakePath = '/fake-path' ;
16+
1517 TestBed . configureTestingModule ( {
1618 imports : imports || [ MatProgressBarModule ] ,
1719 declarations : [ componentType ] ,
1820 providers : [ {
1921 provide : MAT_PROGRESS_BAR_LOCATION ,
20- useValue : { pathname : fakePath }
22+ useValue : { getPathname : ( ) => fakePath }
2123 } ]
2224 } ) . compileComponents ( ) ;
2325
@@ -122,6 +124,23 @@ describe('MatProgressBar', () => {
122124 const svg = fixture . debugElement . query ( By . css ( 'svg' ) ) . nativeElement ;
123125 expect ( svg . getAttribute ( 'focusable' ) ) . toBe ( 'false' ) ;
124126 } ) ;
127+
128+ it ( 'should use latest path when prefixing the SVG references' , ( ) => {
129+ let fixture = createComponent ( BasicProgressBar ) ;
130+ fixture . detectChanges ( ) ;
131+
132+ let rect = fixture . debugElement . query ( By . css ( 'rect' ) ) . nativeElement ;
133+ expect ( rect . getAttribute ( 'fill' ) ) . toMatch ( / ^ u r l \( [ ' " ] ? \/ f a k e - p a t h # .* [ ' " ] ? \) $ / ) ;
134+
135+ fixture . destroy ( ) ;
136+ fakePath = '/another-fake-path' ;
137+
138+ fixture = TestBed . createComponent ( BasicProgressBar ) ;
139+ fixture . detectChanges ( ) ;
140+ rect = fixture . debugElement . query ( By . css ( 'rect' ) ) . nativeElement ;
141+
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+ } ) ;
125144 } ) ;
126145
127146 describe ( 'animation trigger on determinate setting' , ( ) => {
0 commit comments