Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/material/progress-spinner/progress-spinner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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: `
<mat-progress-spinner mode="determinate" [value]="value()"></mat-progress-spinner>
<mat-progress-spinner mode="indeterminate"></mat-progress-spinner>
<mat-spinner></mat-spinner>
<mat-spinner class="with-diameter with-strokeWidth" [diameter]="diameter()" [strokeWidth]="strokeWidth()"></mat-spinner>
`,
standalone: true,
imports: [MatProgressSpinnerModule],
})
class ProgressSpinnerHarnessTest {
value = signal(0);
diameter = signal(30);
strokeWidth = signal(3);
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,22 @@ export class MatProgressSpinnerHarness extends ComponentHarness {

/** Gets the progress spinner's mode. */
async getMode(): Promise<ProgressSpinnerMode> {
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<number | null> {
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<number | null> {
const host = await this.host();
const strokeWidthAttr = await host.getAttribute('data-mat-progress-spinner-strokeWidth');
return strokeWidthAttr ? coerceNumberProperty(strokeWidthAttr) : null;
}
}
Loading