From 277f65a0f5b5f61ac807e05753260fed7dfae346 Mon Sep 17 00:00:00 2001 From: Kristiyan Kostadinov Date: Sat, 18 Feb 2023 22:04:08 +0100 Subject: [PATCH] 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. (cherry picked from commit 3c53deb86477a43cedf930acc6ed7105147006e0) --- src/material/tabs/tab-group.html | 1 + src/material/tabs/tab-group.spec.ts | 21 ++++++++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/material/tabs/tab-group.html b/src/material/tabs/tab-group.html index 4a5a747fa6b9..27648e3ae6d8 100644 --- a/src/material/tabs/tab-group.html +++ b/src/material/tabs/tab-group.html @@ -1,6 +1,7 @@ diff --git a/src/material/tabs/tab-group.spec.ts b/src/material/tabs/tab-group.spec.ts index 32d5f486f37c..371232caf531 100644 --- a/src/material/tabs/tab-group.spec.ts +++ b/src/material/tabs/tab-group.spec.ts @@ -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', () => { @@ -1111,7 +1128,8 @@ class SimpleTabsTestApp { + (selectedTabChange)="handleSelection($event)" + [disablePagination]="disablePagination"> {{tab.label}} {{tab.content}} @@ -1128,6 +1146,7 @@ class SimpleDynamicTabsTestApp { selectedIndex: number = 1; focusEvent: any; selectEvent: any; + disablePagination = false; handleFocus(event: any) { this.focusEvent = event; }