mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
fix(spinner): set initial value for spinner to 0. (#8139)
This commit is contained in:
committed by
Andrew Seguin
parent
5cef1dc13d
commit
9e4c636821
@@ -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', () => {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user