From 9d51deb194422aa26dcb9b95085ae9440bd88105 Mon Sep 17 00:00:00 2001 From: Robert Messerle Date: Thu, 11 Aug 2016 20:42:34 -0700 Subject: [PATCH] feat(tabs): adds support for `disabled` tabs (#934) closes #880 --- e2e/components/tabs/tabs.e2e.ts | 2 +- src/components/tabs/tab-group.html | 5 +- src/components/tabs/tab-group.scss | 5 ++ src/components/tabs/tab-group.spec.ts | 113 +++++++++++++++++++++++++- src/components/tabs/tabs.ts | 66 +++++++++++---- src/demo-app/tabs/tab-group-demo.html | 4 +- 6 files changed, 172 insertions(+), 23 deletions(-) diff --git a/e2e/components/tabs/tabs.e2e.ts b/e2e/components/tabs/tabs.e2e.ts index a4696d790899..daf4171824a7 100644 --- a/e2e/components/tabs/tabs.e2e.ts +++ b/e2e/components/tabs/tabs.e2e.ts @@ -78,7 +78,7 @@ function getFocusStates(elements: ElementArrayFinder) { * @returns {webdriver.promise.Promise[]>|webdriver.promise.Promise} */ function getActiveStates(elements: ElementArrayFinder) { - return getClassStates(elements, 'md-active'); + return getClassStates(elements, 'md-tab-active'); } /** diff --git a/src/components/tabs/tab-group.html b/src/components/tabs/tab-group.html index 1811d1b3cd88..425d7327b327 100644 --- a/src/components/tabs/tab-group.html +++ b/src/components/tabs/tab-group.html @@ -6,7 +6,8 @@ [tabIndex]="selectedIndex == i ? 0 : -1" [attr.aria-controls]="_getTabContentId(i)" [attr.aria-selected]="selectedIndex == i" - [class.md-active]="selectedIndex == i" + [class.md-tab-active]="selectedIndex == i" + [class.md-tab-disabled]="tab.disabled" (click)="focusIndex = selectedIndex = i"> @@ -17,7 +18,7 @@ role="tabpanel" *ngFor="let tab of _tabs; let i = index" [id]="_getTabContentId(i)" - [class.md-active]="selectedIndex == i" + [class.md-tab-active]="selectedIndex == i" [attr.aria-labelledby]="_getTabLabelId(i)">