Skip to content

Commit d4804c1

Browse files
crisbetojelbourn
authored andcommitted
fix(progress-spinner/testing): harness selector not matching mat-spinner selector (#19657)
The progress spinner has two variations: `mat-progress-spinner` and `mat-spinner`, but the test harness was only accounting for the former. Fixes #19649.
1 parent ebbe8d7 commit d4804c1

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

src/material/progress-spinner/testing/progress-spinner-harness.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {ProgressSpinnerHarnessFilters} from './progress-spinner-harness-filters'
1414
/** Harness for interacting with a standard mat-progress-spinner in tests. */
1515
export class MatProgressSpinnerHarness extends ComponentHarness {
1616
/** The selector for the host element of a `MatProgressSpinner` instance. */
17-
static hostSelector = 'mat-progress-spinner';
17+
static hostSelector = 'mat-progress-spinner,mat-spinner';
1818

1919
/**
2020
* Gets a `HarnessPredicate` that can be used to search for a `MatProgressSpinnerHarness` that

src/material/progress-spinner/testing/shared.spec.ts

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,27 +26,38 @@ export function runHarnessTests(progressSpinnerModule: typeof MatProgressSpinner
2626

2727
it('should load all progress spinner harnesses', async () => {
2828
const progressSpinners = await loader.getAllHarnesses(progressSpinnerHarness);
29-
expect(progressSpinners.length).toBe(2);
29+
expect(progressSpinners.length).toBe(3);
3030
});
3131

3232
it('should get the value', async () => {
3333
fixture.componentInstance.value = 50;
34-
const [determinate, indeterminate] = await loader.getAllHarnesses(progressSpinnerHarness);
34+
const [
35+
determinate,
36+
indeterminate,
37+
impliedIndeterminate
38+
] = await loader.getAllHarnesses(progressSpinnerHarness);
3539
expect(await determinate.getValue()).toBe(50);
3640
expect(await indeterminate.getValue()).toBe(null);
41+
expect(await impliedIndeterminate.getValue()).toBe(null);
3742
});
3843

3944
it('should get the mode', async () => {
40-
const [determinate, indeterminate] = await loader.getAllHarnesses(progressSpinnerHarness);
45+
const [
46+
determinate,
47+
indeterminate,
48+
impliedIndeterminate
49+
] = await loader.getAllHarnesses(progressSpinnerHarness);
4150
expect(await determinate.getMode()).toBe('determinate');
4251
expect(await indeterminate.getMode()).toBe('indeterminate');
52+
expect(await impliedIndeterminate.getMode()).toBe('indeterminate');
4353
});
4454
}
4555

4656
@Component({
4757
template: `
4858
<mat-progress-spinner mode="determinate" [value]="value"></mat-progress-spinner>
4959
<mat-progress-spinner mode="indeterminate"></mat-progress-spinner>
60+
<mat-spinner></mat-spinner>
5061
`
5162
})
5263
class ProgressSpinnerHarnessTest {

0 commit comments

Comments
 (0)