fix(spinner): set initial value for spinner to 0. (#8139)

This commit is contained in:
Joey Perrott
2017-11-01 20:20:48 -07:00
committed by Andrew Seguin
parent 5cef1dc13d
commit 9e4c636821
2 changed files with 4 additions and 4 deletions
@@ -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', () => {
+2 -2
View File
@@ -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) {