Skip to content

Commit 3989c1c

Browse files
committed
feat(material/tabs): Responded to PR feedback.
1 parent 95e1823 commit 3989c1c

File tree

8 files changed

+8
-27
lines changed

8 files changed

+8
-27
lines changed

src/material-experimental/mdc-tabs/testing/tab-link-harness.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,6 @@ export class MatTabLinkHarness extends ComponentHarness {
3333
return (await this.host()).text();
3434
}
3535

36-
/** Gets the value of the `aria-controls` attribute. */
37-
async getAriaControls(): Promise<string | null> {
38-
const host = await this.host();
39-
return host.getAttribute('aria-controls');
40-
}
41-
4236
/** Whether the link is active. */
4337
async isActive(): Promise<boolean> {
4438
const host = await this.host();

src/material-experimental/mdc-tabs/testing/tab-nav-bar-harness.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ export class MatTabNavBarHarness extends ComponentHarness {
6666
/** Gets the panel associated with the nav bar. */
6767
async getPanel(): Promise<MatTabNavPanelHarness> {
6868
const link = await this.getActiveLink();
69-
const panelId = await link.getAriaControls();
69+
const host = await link.host();
70+
const panelId = await host.getAttribute('aria-controls');
7071
if (!panelId) {
7172
throw Error('No panel is controlled by the nav bar.');
7273
}

src/material-experimental/mdc-tabs/testing/tab-nav-panel-harness.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
import {ComponentHarness, HarnessPredicate} from '@angular/cdk/testing';
9+
import {ContentContainerComponentHarness, HarnessPredicate} from '@angular/cdk/testing';
1010
import {TabNavPanelHarnessFilters} from './tab-harness-filters';
1111

1212
/** Harness for interacting with a standard mat-tab-nav-panel in tests. */
13-
export class MatTabNavPanelHarness extends ComponentHarness {
13+
export class MatTabNavPanelHarness extends ContentContainerComponentHarness {
1414
/** The selector for the host element of a `MatTabNavPanel` instance. */
1515
static hostSelector = '.mat-mdc-tab-nav-panel';
1616

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

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,6 @@ export class MatTabLinkHarness extends ComponentHarness {
3333
return (await this.host()).text();
3434
}
3535

36-
/** Gets the value of the `aria-controls` attribute. */
37-
async getAriaControls(): Promise<string | null> {
38-
const host = await this.host();
39-
return host.getAttribute('aria-controls');
40-
}
41-
4236
/** Whether the link is active. */
4337
async isActive(): Promise<boolean> {
4438
const host = await this.host();

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ export class MatTabNavBarHarness extends ComponentHarness {
6666
/** Gets the panel associated with the nav bar. */
6767
async getPanel(): Promise<MatTabNavPanelHarness> {
6868
const link = await this.getActiveLink();
69-
const panelId = await link.getAriaControls();
69+
const host = await link.host();
70+
const panelId = await host.getAttribute('aria-controls');
7071
if (!panelId) {
7172
throw Error('No panel is controlled by the nav bar.');
7273
}

src/material/tabs/testing/tab-nav-bar-shared.spec.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,6 @@ export function runTabNavBarHarnessTests(
6565
expect(await links[2].getLabel()).toBe('Third');
6666
});
6767

68-
it('should be able to get the `aria-controls` attribute value of link', async () => {
69-
const navBar = await loader.getHarness(tabNavBarHarness);
70-
const links = await navBar.getLinks();
71-
expect(await links[0].getAriaControls()).toBe('tab-panel');
72-
expect(await links[1].getAriaControls()).toBe('tab-panel');
73-
expect(await links[2].getAriaControls()).toBe('tab-panel');
74-
});
75-
7668
it('should be able to get disabled state of link', async () => {
7769
const navBar = await loader.getHarness(tabNavBarHarness);
7870
const links = await navBar.getLinks();

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
import {ComponentHarness, HarnessPredicate} from '@angular/cdk/testing';
9+
import {ContentContainerComponentHarness, HarnessPredicate} from '@angular/cdk/testing';
1010
import {TabNavPanelHarnessFilters} from './tab-harness-filters';
1111

1212
/** Harness for interacting with a standard mat-tab-nav-panel in tests. */
13-
export class MatTabNavPanelHarness extends ComponentHarness {
13+
export class MatTabNavPanelHarness extends ContentContainerComponentHarness {
1414
/** The selector for the host element of a `MatTabNavPanel` instance. */
1515
static hostSelector = '.mat-tab-nav-panel';
1616

tools/public_api_guard/material/tabs-testing.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ export class MatTabHarness extends ContentContainerComponentHarness<string> {
3737
// @public
3838
export class MatTabLinkHarness extends ComponentHarness {
3939
click(): Promise<void>;
40-
getAriaControls(): Promise<string | null>;
4140
getLabel(): Promise<string>;
4241
static hostSelector: string;
4342
isActive(): Promise<boolean>;

0 commit comments

Comments
 (0)