Skip to content

Commit 9828a7b

Browse files
CopilotLipata
andcommitted
revert: remove changes to move to existing PR #16068
Co-authored-by: Lipata <[email protected]>
1 parent 0e1c7f2 commit 9828a7b

File tree

3 files changed

+6
-121
lines changed

3 files changed

+6
-121
lines changed

projects/igniteui-angular/src/lib/tabs/tab-header.directive.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@ export abstract class IgxTabHeaderDirective implements IgxTabHeaderBase {
4040
/** @hidden */
4141
@HostListener('click')
4242
public onClick() {
43-
this.tabs.selectTab(this.tab, true);
43+
if (this.tab.panelComponent) {
44+
this.tabs.selectTab(this.tab, true);
45+
}
4446
}
4547

4648
/** @hidden */

projects/igniteui-angular/src/lib/tabs/tabs/README.md

Lines changed: 3 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
## Description
44
_igx-tabs component allows you to add a tabs component with tab items, positioned at the top, and item content in your application. The tabs in Ignite UI for Angular can be composed with the following components and directives:_
55

6-
- *igx-tab-item* - single content area that holds header and optionally content components
6+
- *igx-tab-item* - single content area that holds header and content components
77
- *igx-tab-header* - holds the title and/or icon of the item and you can add them with `igxTabHeaderIcon` and `igxTabHeaderLabel`
8-
- *igx-tab-content* - represents the wrapper of the content that needs to be displayed (optional)
8+
- *igx-tab-content* - represents the wrapper of the content that needs to be displayed
99

10-
Each item (`igx-tab-item`) contains a header (`igx-tab-header`) and optionally content (`igx-tab-content`). When a tab is clicked, the associated content is selected and visualized into a single container. If a tab has no content, it can still be selected and used for navigation purposes. There should always be a selected tab. Only one tab can be selected at a time.
10+
Each item (`igx-tab-item`) contains header (`igx-tab-header`) and content (`igx-tab-content`). When a tab is clicked, the associated content is selected and visualized into a single container. There should always be a selected tab. Only one tab can be selected at a time.
1111
A walkthrough of how to get started can be found [here](https://www.infragistics.com/products/ignite-ui-angular/angular/components/tabs).
1212

1313
----------
@@ -59,33 +59,6 @@ A walkthrough of how to get started can be found [here](https://www.infragistics
5959
</igx-tab-item>
6060
</igx-tabs>
6161

62-
## Tabs without content (Navigation-only)
63-
64-
For navigation purposes, you can create tabs without content:
65-
66-
<igx-tabs>
67-
<igx-tab-item>
68-
<igx-tab-header igxRipple>
69-
<igx-icon igxTabHeaderIcon>home</igx-icon>
70-
<span igxTabHeaderLabel>Home</span>
71-
</igx-tab-header>
72-
</igx-tab-item>
73-
74-
<igx-tab-item [selected]="true">
75-
<igx-tab-header igxRipple>
76-
<igx-icon igxTabHeaderIcon>info</igx-icon>
77-
<span igxTabHeaderLabel>About</span>
78-
</igx-tab-header>
79-
</igx-tab-item>
80-
81-
<igx-tab-item>
82-
<igx-tab-header igxRipple>
83-
<igx-icon igxTabHeaderIcon>contact_page</igx-icon>
84-
<span igxTabHeaderLabel>Contact</span>
85-
</igx-tab-header>
86-
</igx-tab-item>
87-
</igx-tabs>
88-
8962

9063
# API Summary
9164

projects/igniteui-angular/src/lib/tabs/tabs/tabs.component.spec.ts

Lines changed: 0 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -865,35 +865,6 @@ describe('IgxTabs', () => {
865865
fixture.detectChanges();
866866
expect(tabsComp.selectedIndicator.nativeElement.style.visibility).toBe('hidden');
867867
});
868-
869-
it('should allow clicking on tabs without content to select them', fakeAsync(() => {
870-
tick(100);
871-
fixture.detectChanges();
872-
873-
// Initially Tab 2 should be selected (based on the test component)
874-
expect(tabItems[1].selected).toBe(true);
875-
expect(tabsComp.selectedIndex).toBe(1);
876-
877-
// Click on Tab 1 (which has no content)
878-
headerElements[0].dispatchEvent(new Event('click', { bubbles: true }));
879-
tick(200);
880-
fixture.detectChanges();
881-
882-
// Tab 1 should now be selected
883-
expect(tabsComp.selectedIndex).toBe(0);
884-
expect(tabItems[0].selected).toBe(true);
885-
expect(tabItems[1].selected).toBe(false);
886-
887-
// Click on Tab 3 (which also has no content)
888-
headerElements[2].dispatchEvent(new Event('click', { bubbles: true }));
889-
tick(200);
890-
fixture.detectChanges();
891-
892-
// Tab 3 should now be selected
893-
expect(tabsComp.selectedIndex).toBe(2);
894-
expect(tabItems[2].selected).toBe(true);
895-
expect(tabItems[0].selected).toBe(false);
896-
}));
897868
});
898869

899870
describe('Tabs-only Mode With Initial Selection Set on Tabs Component Tests', () => {
@@ -924,67 +895,6 @@ describe('IgxTabs', () => {
924895
expect(headerElements[2].classList.contains(tabItemSelectedCssClass)).toBe(true);
925896
});
926897

927-
it('should allow keyboard navigation for tabs without content', fakeAsync(() => {
928-
fixture.detectChanges();
929-
tick(100);
930-
931-
// Initially Tab 3 should be selected (selectedIndex = 2)
932-
expect(tabsComp.selectedIndex).toBe(2);
933-
expect(tabItems[2].selected).toBe(true);
934-
935-
// Focus on Tab 3 and navigate left
936-
headerElements[2].focus();
937-
headerElements[2].dispatchEvent(KEY_LEFT_EVENT);
938-
tick(200);
939-
fixture.detectChanges();
940-
941-
// Should move to Tab 2
942-
expect(tabsComp.selectedIndex).toBe(1);
943-
expect(tabItems[1].selected).toBe(true);
944-
expect(tabItems[2].selected).toBe(false);
945-
}));
946-
947-
it('should fire events when clicking on tabs without content', fakeAsync(() => {
948-
// Set up a clean test with the first test group (tab 2 initially selected)
949-
fixture = TestBed.createComponent(TabsTabsOnlyModeTest1Component);
950-
tabsComp = fixture.componentInstance.tabs;
951-
fixture.detectChanges();
952-
tabItems = tabsComp.items.toArray();
953-
headerElements = tabItems.map(item => item.headerComponent.nativeElement);
954-
955-
const indexChangingSpy = spyOn(tabsComp.selectedIndexChanging, 'emit');
956-
const indexChangeSpy = spyOn(tabsComp.selectedIndexChange, 'emit');
957-
const itemChangeSpy = spyOn(tabsComp.selectedItemChange, 'emit');
958-
959-
tick(100);
960-
fixture.detectChanges();
961-
962-
// Initially Tab 2 should be selected (index 1)
963-
expect(tabsComp.selectedIndex).toBe(1);
964-
965-
// Click on Tab 1 (which has no content)
966-
headerElements[0].dispatchEvent(new Event('click', { bubbles: true }));
967-
tick(200);
968-
fixture.detectChanges();
969-
970-
// Tab should be selected
971-
expect(tabsComp.selectedIndex).toBe(0);
972-
973-
// Events should have fired
974-
expect(indexChangingSpy).toHaveBeenCalledWith({
975-
owner: tabsComp,
976-
cancel: false,
977-
oldIndex: 1,
978-
newIndex: 0
979-
});
980-
expect(indexChangeSpy).toHaveBeenCalledWith(0);
981-
expect(itemChangeSpy).toHaveBeenCalledWith({
982-
owner: tabsComp,
983-
oldItem: tabItems[1],
984-
newItem: tabItems[0]
985-
});
986-
}));
987-
988898
});
989899

990900
describe('Events', () => {

0 commit comments

Comments
 (0)