From 7d8f9c8d73f16c01ed4a941ab9510377a0aae219 Mon Sep 17 00:00:00 2001 From: Material Web Team Date: Fri, 27 Mar 2020 10:44:58 -0700 Subject: [PATCH] feat(circular-progress): Add foundation methods to get isDeterminate and progress value PiperOrigin-RevId: 303361359 --- packages/mdc-circular-progress/foundation.ts | 8 ++++++++ packages/mdc-circular-progress/test/foundation.test.ts | 3 +++ 2 files changed, 11 insertions(+) diff --git a/packages/mdc-circular-progress/foundation.ts b/packages/mdc-circular-progress/foundation.ts index fe18caf117a..6f2b42385cd 100644 --- a/packages/mdc-circular-progress/foundation.ts +++ b/packages/mdc-circular-progress/foundation.ts @@ -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. */ diff --git a/packages/mdc-circular-progress/test/foundation.test.ts b/packages/mdc-circular-progress/test/foundation.test.ts index 7ee71a42c1a..7d0fc467053 100644 --- a/packages/mdc-circular-progress/test/foundation.test.ts +++ b/packages/mdc-circular-progress/test/foundation.test.ts @@ -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) @@ -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) @@ -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'); });