Skip to content

Commit

Permalink
feat(circular-progress): Add foundation methods to get isDeterminate …
Browse files Browse the repository at this point in the history
…and progress value

PiperOrigin-RevId: 303361359
  • Loading branch information
material-web-copybara authored and allan-chen committed Mar 27, 2020
1 parent 2e4542e commit 7d8f9c8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packages/mdc-circular-progress/foundation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,14 @@ export class MDCCircularProgressFoundation extends
Number(this.adapter_.getDeterminateCircleAttribute(strings.RADIUS));
}

isDeterminate() {
return this.isDeterminate_;
}

getProgress() {
return this.progress_;
}

/**
* @return Returns whether the progress indicator is hidden.
*/
Expand Down
3 changes: 3 additions & 0 deletions packages/mdc-circular-progress/test/foundation.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ describe('MDCCircularProgressFoundation', () => {
.and.returnValue(false);
foundation.init();
foundation.setDeterminate(false);
expect(foundation.isDeterminate()).toBe(false);
expect(mockAdapter.addClass)
.toHaveBeenCalledWith(cssClasses.INDETERMINATE_CLASS);
expect(mockAdapter.removeAttribute)
Expand All @@ -75,6 +76,7 @@ describe('MDCCircularProgressFoundation', () => {
.and.returnValue(true);
foundation.init();
foundation.setDeterminate(true);
expect(foundation.isDeterminate()).toBe(true);
expect(mockAdapter.removeClass)
.toHaveBeenCalledWith(cssClasses.INDETERMINATE_CLASS);
expect(mockAdapter.setDeterminateCircleAttribute)
Expand Down Expand Up @@ -128,6 +130,7 @@ describe('MDCCircularProgressFoundation', () => {
.and.returnValue(false);
foundation.init();
foundation.setProgress(0.5);
expect(foundation.getProgress()).toEqual(0.5);
expect(mockAdapter.setAttribute)
.toHaveBeenCalledWith(strings.ARIA_VALUENOW, '0.5');
});
Expand Down

0 comments on commit 7d8f9c8

Please sign in to comment.