Skip to content

Commit 3c53deb

Browse files
authored
fix(material/tabs): disablePagination not working (#26647)
The tab group wasn't passing the `disablePagination` input to the tab header so it wasn't being picked up. Fixes #26621.
1 parent 1e9eba7 commit 3c53deb

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

src/material/tabs/tab-group.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<mat-tab-header #tabHeader
22
[selectedIndex]="selectedIndex || 0"
33
[disableRipple]="disableRipple"
4+
[disablePagination]="disablePagination"
45
(indexFocused)="_focusChanged($event)"
56
(selectFocusedIndex)="selectedIndex = $event">
67

src/material/tabs/tab-group.spec.ts

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -622,6 +622,23 @@ describe('MDC-based MatTabGroup', () => {
622622
jasmine.objectContaining({index: 1}),
623623
);
624624
}));
625+
626+
it('should be able to disable the pagination', fakeAsync(() => {
627+
fixture.componentInstance.disablePagination = true;
628+
fixture.detectChanges();
629+
tick();
630+
631+
for (let i = 0; i < 50; i++) {
632+
fixture.componentInstance.tabs.push({label: `Extra ${i}`, content: ''});
633+
}
634+
635+
fixture.detectChanges();
636+
tick();
637+
638+
expect(
639+
fixture.nativeElement.querySelector('.mat-mdc-tab-header-pagination-controls-enabled'),
640+
).toBeFalsy();
641+
}));
625642
});
626643

627644
describe('async tabs', () => {
@@ -1111,7 +1128,8 @@ class SimpleTabsTestApp {
11111128
<mat-tab-group class="tab-group"
11121129
[(selectedIndex)]="selectedIndex"
11131130
(focusChange)="handleFocus($event)"
1114-
(selectedTabChange)="handleSelection($event)">
1131+
(selectedTabChange)="handleSelection($event)"
1132+
[disablePagination]="disablePagination">
11151133
<mat-tab *ngFor="let tab of tabs">
11161134
<ng-template mat-tab-label>{{tab.label}}</ng-template>
11171135
{{tab.content}}
@@ -1128,6 +1146,7 @@ class SimpleDynamicTabsTestApp {
11281146
selectedIndex: number = 1;
11291147
focusEvent: any;
11301148
selectEvent: any;
1149+
disablePagination = false;
11311150
handleFocus(event: any) {
11321151
this.focusEvent = event;
11331152
}

0 commit comments

Comments
 (0)