Skip to content

Commit

Permalink
fix(spinner): set initial value for spinner to 0. (#8139)
Browse files Browse the repository at this point in the history
  • Loading branch information
josephperrott authored and andrewseguin committed Nov 2, 2017
1 parent 5cef1dc commit 9e4c636
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/lib/progress-spinner/progress-spinner.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down
4 changes: 2 additions & 2 deletions src/lib/progress-spinner/progress-spinner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 9e4c636

Please sign in to comment.