Skip to content

Commit 9e4c636

Browse files
josephperrottandrewseguin
authored andcommitted
fix(spinner): set initial value for spinner to 0. (#8139)
1 parent 5cef1dc commit 9e4c636

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/lib/progress-spinner/progress-spinner.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@ describe('MatProgressSpinner', () => {
3737
expect(progressElement.componentInstance.mode).toBe('indeterminate');
3838
});
3939

40-
it('should define a default value of undefined for the value attribute', () => {
40+
it('should define a default value of zero for the value attribute', () => {
4141
let fixture = TestBed.createComponent(BasicProgressSpinner);
4242
fixture.detectChanges();
4343

4444
let progressElement = fixture.debugElement.query(By.css('mat-progress-spinner'));
45-
expect(progressElement.componentInstance.value).toBeUndefined();
45+
expect(progressElement.componentInstance.value).toBe(0);
4646
});
4747

4848
it('should set the value to 0 when the mode is set to indeterminate', () => {

src/lib/progress-spinner/progress-spinner.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ const INDETERMINATE_ANIMATION_TEMPLATE = `
8383
export class MatProgressSpinner extends _MatProgressSpinnerMixinBase implements CanColor,
8484
OnChanges {
8585

86-
private _value: number;
86+
private _value: number = 0;
8787
private readonly _baseSize = 100;
8888
private readonly _baseStrokeWidth = 10;
8989
private _fallbackAnimation = false;
@@ -119,7 +119,7 @@ export class MatProgressSpinner extends _MatProgressSpinnerMixinBase implements
119119

120120
/** Value of the progress circle. */
121121
@Input()
122-
get value() {
122+
get value(): number {
123123
return this.mode === 'determinate' ? this._value : 0;
124124
}
125125
set value(newValue: number) {

0 commit comments

Comments
 (0)