Skip to content

Commit 25daee6

Browse files
committed
address comments
1 parent dc45372 commit 25daee6

File tree

4 files changed

+7
-3
lines changed

4 files changed

+7
-3
lines changed

src/cdk/testing/harness-environment.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ export abstract class HarnessEnvironment<E> implements HarnessLoader, LocatorFac
9090
// Implemented as part of the `LocatorFactory` interface.
9191
async harnessLoaderForOptional(selector: string): Promise<HarnessLoader | null> {
9292
const elements = await this.getAllRawElements(selector);
93-
return elements[0] && this.createEnvironment(elements[0]);
93+
return elements[0] ? this.createEnvironment(elements[0]) : null;
9494
}
9595

9696
// Implemented as part of the `LocatorFactory` interface.

src/material/tabs/testing/shared.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ export function runHarnessTests(
6969
it('should throw error when attempting to select invalid tab', async () => {
7070
const tabGroup = await loader.getHarness(tabGroupHarness);
7171
await expectAsyncError(() => tabGroup.selectTab({label: 'Fake'}),
72-
/Error: Cannot find mat-tab matching {"label":"Fake"}/);
72+
/Error: Cannot find mat-tab matching filter {"label":"Fake"}/);
7373
});
7474

7575
it('should be able to get label of tabs', async () => {

src/material/tabs/testing/tab-group-harness.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export class MatTabGroupHarness extends ComponentHarness {
5555
async selectTab(filter: TabHarnessFilters = {}): Promise<void> {
5656
const tabs = await this.getTabs(filter);
5757
if (!tabs.length) {
58-
throw Error(`Cannot find mat-tab matching ${JSON.stringify(filter)}`);
58+
throw Error(`Cannot find mat-tab matching filter ${JSON.stringify(filter)}`);
5959
}
6060
await tabs[0].select();
6161
}

src/material/tabs/testing/tab-harness.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@ export class MatTabHarness extends ComponentHarness {
6060
await (await this.host()).click();
6161
}
6262

63+
/**
64+
* Gets a `HarnessLoader` that can be used to load harnesses for components within the tab's
65+
* content area.
66+
*/
6367
async getHarnessLoaderForContent(): Promise<HarnessLoader> {
6468
const contentId = await this._getContentId();
6569
return this.documentRootLocatorFactory().harnessLoaderFor(`#${contentId}`);

0 commit comments

Comments
 (0)