diff --git a/src/lib/progress-spinner/progress-spinner-module.ts b/src/lib/progress-spinner/progress-spinner-module.ts
index 7d6485149e38..33eb48479ab8 100644
--- a/src/lib/progress-spinner/progress-spinner-module.ts
+++ b/src/lib/progress-spinner/progress-spinner-module.ts
@@ -6,12 +6,13 @@
* found in the LICENSE file at https://angular.io/license
*/
import {NgModule} from '@angular/core';
+import {CommonModule} from '@angular/common';
import {MatCommonModule} from '@angular/material/core';
import {MatProgressSpinner, MatSpinner} from './progress-spinner';
@NgModule({
- imports: [MatCommonModule],
+ imports: [MatCommonModule, CommonModule],
exports: [
MatProgressSpinner,
MatSpinner,
diff --git a/src/lib/progress-spinner/progress-spinner.html b/src/lib/progress-spinner/progress-spinner.html
index cb5f8db64b44..0bd3cca14b54 100644
--- a/src/lib/progress-spinner/progress-spinner.html
+++ b/src/lib/progress-spinner/progress-spinner.html
@@ -10,9 +10,18 @@
[style.height.px]="diameter"
[attr.viewBox]="_viewBox"
preserveAspectRatio="xMidYMid meet"
- focusable="false">
+ focusable="false"
+ [ngSwitch]="mode === 'indeterminate'">
+
+
+
diff --git a/src/lib/progress-spinner/progress-spinner.spec.ts b/src/lib/progress-spinner/progress-spinner.spec.ts
index 6e1807072675..0f6aa23a362d 100644
--- a/src/lib/progress-spinner/progress-spinner.spec.ts
+++ b/src/lib/progress-spinner/progress-spinner.spec.ts
@@ -83,6 +83,24 @@ describe('MatProgressSpinner', () => {
expect(progressElement.componentInstance.value).toBe(75);
});
+ it('should use different `circle` elements depending on the mode', () => {
+ const fixture = TestBed.createComponent(ProgressSpinnerWithValueAndBoundMode);
+
+ fixture.componentInstance.mode = 'determinate';
+ fixture.detectChanges();
+
+ const determinateCircle = fixture.nativeElement.querySelector('circle');
+
+ fixture.componentInstance.mode = 'indeterminate';
+ fixture.detectChanges();
+
+ const indeterminateCircle = fixture.nativeElement.querySelector('circle');
+
+ expect(determinateCircle).toBeTruthy();
+ expect(indeterminateCircle).toBeTruthy();
+ expect(determinateCircle).not.toBe(indeterminateCircle);
+ });
+
it('should clamp the value of the progress between 0 and 100', () => {
let fixture = TestBed.createComponent(BasicProgressSpinner);
fixture.detectChanges();
@@ -138,12 +156,13 @@ describe('MatProgressSpinner', () => {
it('should allow a custom stroke width', () => {
const fixture = TestBed.createComponent(ProgressSpinnerCustomStrokeWidth);
- const circleElement = fixture.nativeElement.querySelector('circle');
- const svgElement = fixture.nativeElement.querySelector('svg');
fixture.componentInstance.strokeWidth = 40;
fixture.detectChanges();
+ const circleElement = fixture.nativeElement.querySelector('circle');
+ const svgElement = fixture.nativeElement.querySelector('svg');
+
expect(parseInt(circleElement.style.strokeWidth)).toBe(40, 'Expected the custom stroke ' +
'width to be applied to the circle element as a percentage of the element size.');
expect(svgElement.getAttribute('viewBox'))