Skip to content

Commit f42fee0

Browse files
authored
feat(material/tabs): Throw error in MDC tabs if [tabPanel] input is not provided (#24517)
* feat(material/tabs): Throw error in MDC tabs if [tabPanel] is not provided. * feat(material/tabs): Exclude some tests from MDC * feat(material/tabs): Add tab panel to kitchen sinks
1 parent 025a534 commit f42fee0

File tree

9 files changed

+294
-384
lines changed

9 files changed

+294
-384
lines changed

scripts/check-mdc-tests-config.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,5 +185,15 @@ export const config = {
185185
'should set the old snack bar animation state to complete and the new snack bar ' +
186186
'animation state to visible on entry of new snack bar',
187187
],
188+
'mdc-tabs': [
189+
// These tests are excluded because they are verifying behavior that is not supported in MDC.
190+
'should have no explicit roles',
191+
'should not setup aria-controls',
192+
'should not manage aria-selected',
193+
'should not activate a link when space is pressed',
194+
'should manage aria-current',
195+
'should support the native tabindex attribute',
196+
'should support binding to the tabIndex',
197+
],
188198
} as {[key: string]: string[]},
189199
};

src/dev-app/mdc-tabs/mdc-tabs-demo.html

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,13 @@ <h2>Ink bar fit to content</h2>
101101
</mat-tab-group>
102102

103103
<h2>Ink bar fit to content</h2>
104-
<nav mat-tab-nav-bar [fitInkBarToContent]="fitInkBarToContent">
104+
<nav mat-tab-nav-bar [fitInkBarToContent]="fitInkBarToContent" [tabPanel]="tabPanelInkBar">
105105
<a mat-tab-link *ngFor="let link of links"
106106
(click)="activeLink = link"
107107
[active]="activeLink == link">{{link}}</a>
108108
<a mat-tab-link disabled>Disabled Link</a>
109109
</nav>
110+
<mat-tab-nav-panel #tabPanelInkBar></mat-tab-nav-panel>
110111

111112
<h2>Lazy tabs</h2>
112113
<mat-tab-group>
@@ -121,14 +122,6 @@ <h2>Lazy tabs</h2>
121122
</mat-tab-group>
122123

123124
<h2>Tab nav bar</h2>
124-
<nav mat-tab-nav-bar>
125-
<a mat-tab-link *ngFor="let link of links"
126-
(click)="activeLink = link"
127-
[active]="activeLink == link">{{link}}</a>
128-
<a mat-tab-link disabled>Disabled Link</a>
129-
</nav>
130-
131-
<h2>Tab nav bar with panel</h2>
132125
<nav mat-tab-nav-bar [tabPanel]="tabPanel">
133126
<a mat-tab-link *ngFor="let link of links"
134127
(click)="activeLink = link"

src/material-experimental/mdc-tabs/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ The experimental tabs API closely matches the
8080
as all of the symbols found under `@angular/material/tabs`, except for the following
8181
differences:
8282

83+
* `MatTabNav` will throw an error in dev mode if a `[tabPanel]` is not provided.
8384
* `MatTabLink` is defined as a `Component` in the experimental package,
8485
whereas in the current one it's a `Directive`.
8586

0 commit comments

Comments
 (0)