Skip to content

Commit a7978a2

Browse files
author
INFRAGISTICS\tiliev
committed
Merge branch 'rkaraivanov/multi-column-headers' of https://github.com/IgniteUI/igniteui-angular into rkaraivanov/multi-column-headers
2 parents 125f9c0 + 2057c46 commit a7978a2

File tree

1 file changed

+33
-4
lines changed

1 file changed

+33
-4
lines changed

projects/igniteui-angular/src/lib/grid/column-group.spec.ts

+33-4
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ describe('IgxGrid - multi-column headers', () => {
2323
OneGroupThreeColsGridComponent,
2424
BlueWhaleGridComponent,
2525
ColumnGroupTestComponent,
26+
ColumnGroupChildLevelTestComponent,
2627
ColumnGroupFourLevelTestComponent,
2728
ThreeGroupsThreeColumnsGridComponent,
2829
ColumnGroupTwoGroupsTestComponent
@@ -46,7 +47,7 @@ describe('IgxGrid - multi-column headers', () => {
4647
});
4748

4849
it('column hiding - parent level', () => {
49-
const fixture = TestBed.createComponent(ColumnGroupTestComponent);
50+
const fixture = TestBed.createComponent(ColumnGroupFourLevelTestComponent);
5051
fixture.detectChanges();
5152
const grid = fixture.componentInstance.grid;
5253
const addressGroup = grid.columnList.filter(c => c.header === 'Address Information')[0];
@@ -58,15 +59,15 @@ describe('IgxGrid - multi-column headers', () => {
5859
});
5960

6061
it('column hiding - child level', () => {
61-
const fixture = TestBed.createComponent(ColumnGroupTestComponent);
62+
const fixture = TestBed.createComponent(ColumnGroupChildLevelTestComponent);
6263
fixture.detectChanges();
6364
const grid = fixture.componentInstance.grid;
64-
const addressGroup = grid.columnList.filter(c => c.header === 'Address Information')[0];
65+
const addressGroup = grid.columnList.filter(c => c.header === 'Address')[0];
6566

6667
addressGroup.children.first.hidden = true;
6768
fixture.detectChanges();
6869

69-
expect(document.querySelectorAll('igx-grid-header').length).toEqual(11);
70+
expect(document.querySelectorAll('igx-grid-header').length).toEqual(5);
7071
expect(addressGroup.children.first.hidden).toBe(true);
7172
expect(addressGroup.children.first.children.toArray().every(c => c.hidden === true)).toEqual(true);
7273
});
@@ -865,6 +866,34 @@ export class ColumnGroupFourLevelTestComponent {
865866
data = DATASOURCE;
866867
}
867868

869+
@Component({
870+
template: `
871+
<igx-grid #grid [data]="data" height="600px" width="800px">
872+
<igx-column field="ID"></igx-column>
873+
<igx-column-group header="Address">
874+
<igx-column-group header="Location">
875+
<igx-column field="Country"></igx-column>
876+
<igx-column field="Region"></igx-column>
877+
<igx-column-group header="Location City">
878+
<igx-column field="City"></igx-column>
879+
<igx-column field="Address"></igx-column>
880+
</igx-column-group>
881+
</igx-column-group>
882+
<igx-column-group header="Contact Information">
883+
<igx-column field="Phone"></igx-column>
884+
<igx-column field="Fax"></igx-column>
885+
</igx-column-group>
886+
</igx-column-group>
887+
</igx-grid>
888+
`
889+
})
890+
export class ColumnGroupChildLevelTestComponent {
891+
@ViewChild(IgxGridComponent, { read: IgxGridComponent })
892+
grid: IgxGridComponent;
893+
894+
data = DATASOURCE;
895+
}
896+
868897

869898
@Component({
870899
template: `

0 commit comments

Comments
 (0)