diff --git a/src/material/progress-spinner/progress-spinner.ts b/src/material/progress-spinner/progress-spinner.ts index a8b805e88224..653960c5409f 100644 --- a/src/material/progress-spinner/progress-spinner.ts +++ b/src/material/progress-spinner/progress-spinner.ts @@ -86,7 +86,9 @@ const BASE_STROKE_WIDTH = 10; '[attr.aria-valuemin]': '0', '[attr.aria-valuemax]': '100', '[attr.aria-valuenow]': 'mode === "determinate" ? value : null', - '[attr.mode]': 'mode', + '[attr.data-mat-progress-spinner-mode]': 'mode', + '[attr.data-mat-progress-spinner-diameter]': 'diameter', + '[attr.data-mat-progress-spinner-strokeWidth]': 'strokeWidth', }, templateUrl: 'progress-spinner.html', styleUrl: 'progress-spinner.css', diff --git a/src/material/progress-spinner/testing/progress-spinner-harness.spec.ts b/src/material/progress-spinner/testing/progress-spinner-harness.spec.ts index bac8d2eb0d60..63f4f911cf75 100644 --- a/src/material/progress-spinner/testing/progress-spinner-harness.spec.ts +++ b/src/material/progress-spinner/testing/progress-spinner-harness.spec.ts @@ -40,17 +40,33 @@ describe('MatProgressSpinnerHarness', () => { expect(await indeterminate.getMode()).toBe('indeterminate'); expect(await impliedIndeterminate.getMode()).toBe('indeterminate'); }); + + it('should get the diameter', async () => { + fixture.componentInstance.diameter.set(20); + const withAttributs = + await loader.getHarness(MatProgressSpinnerHarness.with({selector: '.with-diameter'})); + expect(await withAttributs.getDiameter()).toBe(20); + }); + + it('should get the strokeWidth', async () => { + fixture.componentInstance.strokeWidth.set(5); + const withAttributs = + await loader.getHarness(MatProgressSpinnerHarness.with({selector: '.with-strokeWidth'})); + expect(await withAttributs.getStrokeWidth()).toBe(5); + }); }); @Component({ template: ` - + `, standalone: true, imports: [MatProgressSpinnerModule], }) class ProgressSpinnerHarnessTest { value = signal(0); + diameter = signal(30); + strokeWidth = signal(3); } diff --git a/src/material/progress-spinner/testing/progress-spinner-harness.ts b/src/material/progress-spinner/testing/progress-spinner-harness.ts index 5c161cfd165b..30aa111bf86e 100644 --- a/src/material/progress-spinner/testing/progress-spinner-harness.ts +++ b/src/material/progress-spinner/testing/progress-spinner-harness.ts @@ -42,7 +42,22 @@ export class MatProgressSpinnerHarness extends ComponentHarness { /** Gets the progress spinner's mode. */ async getMode(): Promise { - const modeAttr = (await this.host()).getAttribute('mode'); + const modeAttr = + (await this.host()).getAttribute('data-mat-progress-spinner-mode'); return (await modeAttr) as ProgressSpinnerMode; } + + /** Gets the progress spinner's diameter. */ + async getDiameter(): Promise { + const host = await this.host(); + const diameterAttr = await host.getAttribute('data-mat-progress-spinner-diameter'); + return diameterAttr ? coerceNumberProperty(diameterAttr) : null; + } + + /** Gets the progress spinner's strokeWidth. */ + async getStrokeWidth(): Promise { + const host = await this.host(); + const strokeWidthAttr = await host.getAttribute('data-mat-progress-spinner-strokeWidth'); + return strokeWidthAttr ? coerceNumberProperty(strokeWidthAttr) : null; + } }