Skip to content
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
1 change: 1 addition & 0 deletions src/material/tabs/tab-group.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<mat-tab-header #tabHeader
[selectedIndex]="selectedIndex || 0"
[disableRipple]="disableRipple"
[disablePagination]="disablePagination"
(indexFocused)="_focusChanged($event)"
(selectFocusedIndex)="selectedIndex = $event">

Expand Down
21 changes: 20 additions & 1 deletion src/material/tabs/tab-group.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -622,6 +622,23 @@ describe('MDC-based MatTabGroup', () => {
jasmine.objectContaining({index: 1}),
);
}));

it('should be able to disable the pagination', fakeAsync(() => {
fixture.componentInstance.disablePagination = true;
fixture.detectChanges();
tick();

for (let i = 0; i < 50; i++) {
fixture.componentInstance.tabs.push({label: `Extra ${i}`, content: ''});
}

fixture.detectChanges();
tick();

expect(
fixture.nativeElement.querySelector('.mat-mdc-tab-header-pagination-controls-enabled'),
).toBeFalsy();
}));
});

describe('async tabs', () => {
Expand Down Expand Up @@ -1111,7 +1128,8 @@ class SimpleTabsTestApp {
<mat-tab-group class="tab-group"
[(selectedIndex)]="selectedIndex"
(focusChange)="handleFocus($event)"
(selectedTabChange)="handleSelection($event)">
(selectedTabChange)="handleSelection($event)"
[disablePagination]="disablePagination">
<mat-tab *ngFor="let tab of tabs">
<ng-template mat-tab-label>{{tab.label}}</ng-template>
{{tab.content}}
Expand All @@ -1128,6 +1146,7 @@ class SimpleDynamicTabsTestApp {
selectedIndex: number = 1;
focusEvent: any;
selectEvent: any;
disablePagination = false;
handleFocus(event: any) {
this.focusEvent = event;
}
Expand Down