diff --git a/src/lib/progress-spinner/progress-spinner.spec.ts b/src/lib/progress-spinner/progress-spinner.spec.ts index a1d655d765d4..03c6a9358bc7 100644 --- a/src/lib/progress-spinner/progress-spinner.spec.ts +++ b/src/lib/progress-spinner/progress-spinner.spec.ts @@ -37,12 +37,12 @@ describe('MatProgressSpinner', () => { expect(progressElement.componentInstance.mode).toBe('indeterminate'); }); - it('should define a default value of undefined for the value attribute', () => { + it('should define a default value of zero for the value attribute', () => { let fixture = TestBed.createComponent(BasicProgressSpinner); fixture.detectChanges(); let progressElement = fixture.debugElement.query(By.css('mat-progress-spinner')); - expect(progressElement.componentInstance.value).toBeUndefined(); + expect(progressElement.componentInstance.value).toBe(0); }); it('should set the value to 0 when the mode is set to indeterminate', () => { diff --git a/src/lib/progress-spinner/progress-spinner.ts b/src/lib/progress-spinner/progress-spinner.ts index 5c0973f325ae..e3923167e3d8 100644 --- a/src/lib/progress-spinner/progress-spinner.ts +++ b/src/lib/progress-spinner/progress-spinner.ts @@ -83,7 +83,7 @@ const INDETERMINATE_ANIMATION_TEMPLATE = ` export class MatProgressSpinner extends _MatProgressSpinnerMixinBase implements CanColor, OnChanges { - private _value: number; + private _value: number = 0; private readonly _baseSize = 100; private readonly _baseStrokeWidth = 10; private _fallbackAnimation = false; @@ -119,7 +119,7 @@ export class MatProgressSpinner extends _MatProgressSpinnerMixinBase implements /** Value of the progress circle. */ @Input() - get value() { + get value(): number { return this.mode === 'determinate' ? this._value : 0; } set value(newValue: number) {