Skip to content

fix(progress-spinner/testing): harness selector not matching mat-spinner selector #19657

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 29, 2020
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {ProgressSpinnerHarnessFilters} from './progress-spinner-harness-filters'
/** Harness for interacting with a standard mat-progress-spinner in tests. */
export class MatProgressSpinnerHarness extends ComponentHarness {
/** The selector for the host element of a `MatProgressSpinner` instance. */
static hostSelector = 'mat-progress-spinner';
static hostSelector = 'mat-progress-spinner,mat-spinner';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure about that, but I've seen in other harnesses they use an array of selectors when more than one is needed here 🤔

Copy link
Member Author

@crisbeto crisbeto Jun 16, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like the other places have an array and they join it into a comma-separated string so the result should be the same.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right! thanks 👍


/**
* Gets a `HarnessPredicate` that can be used to search for a `MatProgressSpinnerHarness` that
Expand Down
17 changes: 14 additions & 3 deletions src/material/progress-spinner/testing/shared.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,27 +26,38 @@ export function runHarnessTests(progressSpinnerModule: typeof MatProgressSpinner

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

it('should get the value', async () => {
fixture.componentInstance.value = 50;
const [determinate, indeterminate] = await loader.getAllHarnesses(progressSpinnerHarness);
const [
determinate,
indeterminate,
impliedIndeterminate
] = await loader.getAllHarnesses(progressSpinnerHarness);
expect(await determinate.getValue()).toBe(50);
expect(await indeterminate.getValue()).toBe(null);
expect(await impliedIndeterminate.getValue()).toBe(null);
});

it('should get the mode', async () => {
const [determinate, indeterminate] = await loader.getAllHarnesses(progressSpinnerHarness);
const [
determinate,
indeterminate,
impliedIndeterminate
] = await loader.getAllHarnesses(progressSpinnerHarness);
expect(await determinate.getMode()).toBe('determinate');
expect(await indeterminate.getMode()).toBe('indeterminate');
expect(await impliedIndeterminate.getMode()).toBe('indeterminate');
});
}

@Component({
template: `
<mat-progress-spinner mode="determinate" [value]="value"></mat-progress-spinner>
<mat-progress-spinner mode="indeterminate"></mat-progress-spinner>
<mat-spinner></mat-spinner>
`
})
class ProgressSpinnerHarnessTest {
Expand Down