Skip to content

Commit

Permalink
fix(progress-bar): determinate state reflects value (#542)
Browse files Browse the repository at this point in the history
Fixes #519
  • Loading branch information
sendilkumarn authored and jelbourn committed May 27, 2016
1 parent b47097d commit 6b86df0
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/components/progress-bar/progress-bar.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!-- The background div is named as such because it appears below the other divs and is not sized based on values. -->
<div class="md-progress-bar-background"></div>
<div class="md-progress-bar-buffer" [style.transform]="bufferTransform()"></div>
<div class="md-progress-bar-primary md-progress-bar-fill" [style.transform]="primaryTransform()"></div>
<div class="md-progress-bar-buffer" [ngStyle]="bufferTransform()"></div>
<div class="md-progress-bar-primary md-progress-bar-fill" [ngStyle]="primaryTransform()"></div>
<div class="md-progress-bar-secondary md-progress-bar-fill"></div>
14 changes: 7 additions & 7 deletions src/components/progress-bar/progress-bar.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,27 +88,27 @@ describe('MdProgressBar', () => {
let progressElement = fixture.debugElement.query(By.css('md-progress-bar'));
let progressComponent = progressElement.componentInstance;

expect(progressComponent.primaryTransform()).toBe('scaleX(0)');
expect(progressComponent.primaryTransform()).toEqual({ transform: 'scaleX(0)' });
expect(progressComponent.bufferTransform()).toBe(undefined);

progressComponent.value = 40;
expect(progressComponent.primaryTransform()).toBe('scaleX(0.4)');
expect(progressComponent.primaryTransform()).toEqual({ transform: 'scaleX(0.4)' });
expect(progressComponent.bufferTransform()).toBe(undefined);

progressComponent.value = 35;
progressComponent.bufferValue = 55;
expect(progressComponent.primaryTransform()).toBe('scaleX(0.35)');
expect(progressComponent.primaryTransform()).toEqual({ transform: 'scaleX(0.35)' });
expect(progressComponent.bufferTransform()).toBe(undefined);

progressComponent.mode = 'buffer';
expect(progressComponent.primaryTransform()).toBe('scaleX(0.35)');
expect(progressComponent.bufferTransform()).toBe('scaleX(0.55)');
expect(progressComponent.primaryTransform()).toEqual({ transform: 'scaleX(0.35)' });
expect(progressComponent.bufferTransform()).toEqual({ transform: 'scaleX(0.55)' });


progressComponent.value = 60;
progressComponent.bufferValue = 60;
expect(progressComponent.primaryTransform()).toBe('scaleX(0.6)');
expect(progressComponent.bufferTransform()).toBe('scaleX(0.6)');
expect(progressComponent.primaryTransform()).toEqual({ transform: 'scaleX(0.6)' });
expect(progressComponent.bufferTransform()).toEqual({ transform: 'scaleX(0.6)' });
done();
});
});
Expand Down
4 changes: 2 additions & 2 deletions src/components/progress-bar/progress-bar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export class MdProgressBar {
*/
primaryTransform() {
let scale = this.value / 100;
return `scaleX(${scale})`;
return {transform: `scaleX(${scale})`};
}

/**
Expand All @@ -79,7 +79,7 @@ export class MdProgressBar {
bufferTransform() {
if (this.mode == 'buffer') {
let scale = this.bufferValue / 100;
return `scaleX(${scale})`;
return {transform: `scaleX(${scale})`};
}
}
}
Expand Down

0 comments on commit 6b86df0

Please sign in to comment.