@@ -8,16 +8,18 @@ import {MatProgressBar} from './progress-bar';
8
8
9
9
10
10
describe ( 'MatProgressBar' , ( ) => {
11
- let fakePath = '/fake-path' ;
11
+ let fakePath : string ;
12
12
13
13
function createComponent < T > ( componentType : Type < T > ,
14
14
imports ?: Array < Type < { } > > ) : ComponentFixture < T > {
15
+ fakePath = '/fake-path' ;
16
+
15
17
TestBed . configureTestingModule ( {
16
18
imports : imports || [ MatProgressBarModule ] ,
17
19
declarations : [ componentType ] ,
18
20
providers : [ {
19
21
provide : MAT_PROGRESS_BAR_LOCATION ,
20
- useValue : { pathname : fakePath }
22
+ useValue : { getPathname : ( ) => fakePath }
21
23
} ]
22
24
} ) . compileComponents ( ) ;
23
25
@@ -122,6 +124,23 @@ describe('MatProgressBar', () => {
122
124
const svg = fixture . debugElement . query ( By . css ( 'svg' ) ) . nativeElement ;
123
125
expect ( svg . getAttribute ( 'focusable' ) ) . toBe ( 'false' ) ;
124
126
} ) ;
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
+ } ) ;
125
144
} ) ;
126
145
127
146
describe ( 'animation trigger on determinate setting' , ( ) => {
0 commit comments