diff --git a/packages/mdc-linear-progress/README.md b/packages/mdc-linear-progress/README.md index 23736d93ae0..aa3e2023ea3 100644 --- a/packages/mdc-linear-progress/README.md +++ b/packages/mdc-linear-progress/README.md @@ -130,6 +130,7 @@ MDC Linear Progress Foundation exposes the following methods: | `setProgress(value: number) => void` | Sets the progress bar to this value. Value should be between [0, 1]. | | `getProgress() => number` | The current progress value in the interval [0,1]. | | `setBuffer(value: number) => void` | Sets the buffer bar to this value. Value should be between [0, 1]. | +| `getBuffer() => number` | The current buffer value in the interval [0,1]. | | `open() => void` | Puts the component in the open state. | | `close() => void` | Puts the component in the closed state. | | `isClosed() => boolean` | Whether or not the progress indicator is closed. | diff --git a/packages/mdc-linear-progress/foundation.ts b/packages/mdc-linear-progress/foundation.ts index 67cf929bbbf..e7d4856cc8a 100644 --- a/packages/mdc-linear-progress/foundation.ts +++ b/packages/mdc-linear-progress/foundation.ts @@ -138,6 +138,10 @@ export class MDCLinearProgressFoundation extends } } + getBuffer() { + return this.buffer; + } + open() { this.adapter.removeClass(cssClasses.CLOSED_CLASS); this.adapter.removeClass(cssClasses.CLOSED_ANIMATION_OFF_CLASS); diff --git a/packages/mdc-linear-progress/test/foundation.test.ts b/packages/mdc-linear-progress/test/foundation.test.ts index 953ba74f590..87fe4cc7dc7 100644 --- a/packages/mdc-linear-progress/test/foundation.test.ts +++ b/packages/mdc-linear-progress/test/foundation.test.ts @@ -266,6 +266,7 @@ describe('MDCLinearProgressFoundation', () => { .toHaveBeenCalledWith('transform', 'scaleX(0.5)'); expect(mockAdapter.setAttribute) .toHaveBeenCalledWith(strings.ARIA_VALUENOW, '0.5'); + expect(foundation.getProgress()).toEqual(0.5); }); it('#setProgress on indeterminate does nothing', () => { @@ -286,6 +287,7 @@ describe('MDCLinearProgressFoundation', () => { foundation.setBuffer(0.5); expect(mockAdapter.setBufferBarStyle) .toHaveBeenCalledWith('flex-basis', '50%'); + expect(foundation.getBuffer()).toEqual(0.5); }); it('#setBuffer on indeterminate does nothing', () => {