Skip to content

Commit

Permalink
feat(material/tabs): Throw error in MDC tabs if [tabPanel] input is n…
Browse files Browse the repository at this point in the history
…ot provided (angular#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
  • Loading branch information
zelliott authored and forsti0506 committed Apr 3, 2022
1 parent 77734e0 commit 5504b2f
Show file tree
Hide file tree
Showing 9 changed files with 294 additions and 384 deletions.
10 changes: 10 additions & 0 deletions scripts/check-mdc-tests-config.ts
Expand Up @@ -185,5 +185,15 @@ export const config = {
'should set the old snack bar animation state to complete and the new snack bar ' +
'animation state to visible on entry of new snack bar',
],
'mdc-tabs': [
// These tests are excluded because they are verifying behavior that is not supported in MDC.
'should have no explicit roles',
'should not setup aria-controls',
'should not manage aria-selected',
'should not activate a link when space is pressed',
'should manage aria-current',
'should support the native tabindex attribute',
'should support binding to the tabIndex',
],
} as {[key: string]: string[]},
};
11 changes: 2 additions & 9 deletions src/dev-app/mdc-tabs/mdc-tabs-demo.html
Expand Up @@ -101,12 +101,13 @@ <h2>Ink bar fit to content</h2>
</mat-tab-group>

<h2>Ink bar fit to content</h2>
<nav mat-tab-nav-bar [fitInkBarToContent]="fitInkBarToContent">
<nav mat-tab-nav-bar [fitInkBarToContent]="fitInkBarToContent" [tabPanel]="tabPanelInkBar">
<a mat-tab-link *ngFor="let link of links"
(click)="activeLink = link"
[active]="activeLink == link">{{link}}</a>
<a mat-tab-link disabled>Disabled Link</a>
</nav>
<mat-tab-nav-panel #tabPanelInkBar></mat-tab-nav-panel>

<h2>Lazy tabs</h2>
<mat-tab-group>
Expand All @@ -121,14 +122,6 @@ <h2>Lazy tabs</h2>
</mat-tab-group>

<h2>Tab nav bar</h2>
<nav mat-tab-nav-bar>
<a mat-tab-link *ngFor="let link of links"
(click)="activeLink = link"
[active]="activeLink == link">{{link}}</a>
<a mat-tab-link disabled>Disabled Link</a>
</nav>

<h2>Tab nav bar with panel</h2>
<nav mat-tab-nav-bar [tabPanel]="tabPanel">
<a mat-tab-link *ngFor="let link of links"
(click)="activeLink = link"
Expand Down
1 change: 1 addition & 0 deletions src/material-experimental/mdc-tabs/README.md
Expand Up @@ -80,6 +80,7 @@ The experimental tabs API closely matches the
as all of the symbols found under `@angular/material/tabs`, except for the following
differences:

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

Expand Down

0 comments on commit 5504b2f

Please sign in to comment.