Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Nov 2, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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 @@ -116,7 +116,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