@@ -9,7 +9,7 @@ import { By } from '@angular/platform-browser';
9
9
const GRID_COL_THEAD_TITLE_CLASS = 'igx-grid__th-title' ;
10
10
const GRID_COL_GROUP_THEAD_TITLE_CLASS = 'igx-grid__thead-title' ;
11
11
const GRID_COL_GROUP_THEAD_GROUP_CLASS = 'igx-grid__thead-group' ;
12
- const GRID_COL_THEAD_CLASS = '.igx-grid__th'
12
+ const GRID_COL_THEAD_CLASS = '.igx-grid__th' ;
13
13
14
14
const expectedColumnGroups = 5 ;
15
15
const expectedLevel = 2 ;
@@ -23,7 +23,8 @@ describe('IgxGrid - multi-column headers', () => {
23
23
OneGroupThreeColsGridComponent ,
24
24
BlueWhaleGridComponent ,
25
25
ColumnGroupTestComponent ,
26
- ColumnGroupFourLevelTestComponent
26
+ ColumnGroupFourLevelTestComponent ,
27
+ ThreeGroupsThreeColumnsGridComponent
27
28
] ,
28
29
imports : [
29
30
NoopAnimationsModule ,
@@ -76,14 +77,14 @@ describe('IgxGrid - multi-column headers', () => {
76
77
expect ( document . querySelectorAll ( 'igx-grid-header' ) . length ) . toEqual ( 18 ) ;
77
78
expect ( fixture . debugElement . queryAll ( By . css ( GRID_COL_THEAD_CLASS ) ) . length ) . toEqual ( 11 ) ;
78
79
79
- //Hide individual column
80
+ // Hide individual column
80
81
grid . getColumnByName ( 'ID' ) . hidden = true ;
81
82
fixture . detectChanges ( ) ;
82
83
83
84
expect ( document . querySelectorAll ( 'igx-grid-header' ) . length ) . toEqual ( 17 ) ;
84
85
expect ( fixture . debugElement . queryAll ( By . css ( GRID_COL_THEAD_CLASS ) ) . length ) . toEqual ( 10 ) ;
85
86
86
- //Hide column in goup
87
+ // Hide column in goup
87
88
grid . getColumnByName ( 'CompanyName' ) . hidden = true ;
88
89
fixture . detectChanges ( ) ;
89
90
expect ( document . querySelectorAll ( 'igx-grid-header' ) . length ) . toEqual ( 16 ) ;
@@ -102,7 +103,7 @@ describe('IgxGrid - multi-column headers', () => {
102
103
expect ( document . querySelectorAll ( 'igx-grid-header' ) . length ) . toEqual ( 18 ) ;
103
104
expect ( fixture . debugElement . queryAll ( By . css ( GRID_COL_THEAD_CLASS ) ) . length ) . toEqual ( 11 ) ;
104
105
105
- //Hide 2 columns in the group
106
+ // Hide 2 columns in the group
106
107
grid . getColumnByName ( 'ContactName' ) . hidden = true ;
107
108
grid . getColumnByName ( 'ContactTitle' ) . hidden = true ;
108
109
fixture . detectChanges ( ) ;
@@ -127,7 +128,7 @@ describe('IgxGrid - multi-column headers', () => {
127
128
expect ( document . querySelectorAll ( 'igx-grid-header' ) . length ) . toEqual ( 18 ) ;
128
129
expect ( fixture . debugElement . queryAll ( By . css ( GRID_COL_THEAD_CLASS ) ) . length ) . toEqual ( 11 ) ;
129
130
130
- //Hide 2 columns in the group
131
+ // Hide 2 columns in the group
131
132
grid . getColumnByName ( 'CompanyName' ) . hidden = true ;
132
133
getColGroup ( grid , 'Person Details' ) . hidden = true ;
133
134
fixture . detectChanges ( ) ;
@@ -384,7 +385,7 @@ describe('IgxGrid - multi-column headers', () => {
384
385
fixture . detectChanges ( ) ;
385
386
const grid = fixture . componentInstance . grid ;
386
387
grid . getColumnByName ( 'Fax' ) . hidden = true ;
387
- getColGroup ( grid , 'Person Details' ) . hidden = true ;
388
+ getColGroup ( grid , 'Person Details' ) . hidden = true ;
388
389
fixture . detectChanges ( ) ;
389
390
390
391
expect ( grid . columnList . filter ( col => col . columnGroup ) . length ) . toEqual ( 7 ) ;
@@ -415,7 +416,7 @@ describe('IgxGrid - multi-column headers', () => {
415
416
fixture . detectChanges ( ) ;
416
417
const grid = fixture . componentInstance . grid ;
417
418
grid . getColumnByName ( 'Fax' ) . hidden = true ;
418
- getColGroup ( grid , 'Person Details' ) . hidden = true ;
419
+ getColGroup ( grid , 'Person Details' ) . hidden = true ;
419
420
fixture . detectChanges ( ) ;
420
421
421
422
expect ( grid . columnList . filter ( col => col . columnGroup ) . length ) . toEqual ( 7 ) ;
@@ -437,7 +438,7 @@ describe('IgxGrid - multi-column headers', () => {
437
438
fixture . detectChanges ( ) ;
438
439
const grid = fixture . componentInstance . grid ;
439
440
grid . getColumnByName ( 'Fax' ) . hidden = true ;
440
- getColGroup ( grid , 'Person Details' ) . hidden = true ;
441
+ getColGroup ( grid , 'Person Details' ) . hidden = true ;
441
442
fixture . detectChanges ( ) ;
442
443
443
444
expect ( grid . columnList . filter ( col => col . columnGroup ) . length ) . toEqual ( 7 ) ;
@@ -476,7 +477,7 @@ describe('IgxGrid - multi-column headers', () => {
476
477
fixture . detectChanges ( ) ;
477
478
const grid = fixture . componentInstance . grid ;
478
479
grid . getColumnByName ( 'Fax' ) . hidden = true ;
479
- getColGroup ( grid , 'Person Details' ) . hidden = true ;
480
+ getColGroup ( grid , 'Person Details' ) . hidden = true ;
480
481
fixture . detectChanges ( ) ;
481
482
482
483
expect ( grid . columnList . filter ( col => col . columnGroup ) . length ) . toEqual ( 7 ) ;
@@ -501,7 +502,7 @@ describe('IgxGrid - multi-column headers', () => {
501
502
fixture . detectChanges ( ) ;
502
503
const grid = fixture . componentInstance . grid ;
503
504
grid . getColumnByName ( 'Fax' ) . hidden = true ;
504
- getColGroup ( grid , 'Person Details' ) . hidden = true ;
505
+ getColGroup ( grid , 'Person Details' ) . hidden = true ;
505
506
fixture . detectChanges ( ) ;
506
507
507
508
expect ( grid . columnList . filter ( col => col . columnGroup ) . length ) . toEqual ( 7 ) ;
@@ -635,13 +636,22 @@ describe('IgxGrid - multi-column headers', () => {
635
636
636
637
// Verify group and all its children are pinned
637
638
expect ( grGeneralInf . allChildren . every ( c => c . pinned === true ) ) . toEqual ( true ) ;
638
-
639
+
639
640
expect ( grGeneralInf . visibleIndex ) . toEqual ( - 1 ) ;
640
641
expect ( grid . getColumnByName ( 'CompanyName' ) . visibleIndex ) . toEqual ( 0 ) ;
641
642
642
643
expect ( grid . pinnedColumns . length ) . toEqual ( 5 ) ;
643
644
expect ( grid . unpinnedColumns . length ) . toEqual ( 13 ) ;
644
645
} ) ;
646
+
647
+ xit ( 'Should move column group.' , ( ) => {
648
+ const fixture = TestBed . createComponent ( ThreeGroupsThreeColumnsGridComponent ) ;
649
+ fixture . detectChanges ( ) ;
650
+ const componentInstance = fixture . componentInstance ;
651
+ const grid = componentInstance . grid ;
652
+ grid . moveColumn ( componentInstance . thirdColGroup , componentInstance . firstColGroup ) ;
653
+ fixture . detectChanges ( ) ;
654
+ } ) ;
645
655
} ) ;
646
656
647
657
@Component ( {
@@ -756,6 +766,43 @@ export class ColumnGroupFourLevelTestComponent {
756
766
data = DATASOURCE ;
757
767
}
758
768
769
+ @Component ( {
770
+ template : `
771
+ <igx-grid #grid [data]="data" height="600px" width="1000px">
772
+ <igx-column-group #firstColGroup header="General Information">
773
+ <igx-column field="CompanyName"></igx-column>
774
+ <igx-column field="ContactName"></igx-column>
775
+ <igx-column field="ContactTitle"></igx-column>
776
+ </igx-column-group>
777
+ <igx-column-group #secondColGroup header="Location">
778
+ <igx-column field="Country"></igx-column>
779
+ <igx-column field="Region"></igx-column>
780
+ <igx-column field="City"></igx-column>
781
+ </igx-column-group>
782
+ <igx-column-group #thirdColGroup header="Contact Information">
783
+ <igx-column field="Phone"></igx-column>
784
+ <igx-column field="Fax"></igx-column>
785
+ <igx-column field="PostalCode"></igx-column>
786
+ </igx-column-group>
787
+ </igx-grid>
788
+ `
789
+ } )
790
+ export class ThreeGroupsThreeColumnsGridComponent {
791
+ @ViewChild ( IgxGridComponent , { read : IgxGridComponent } )
792
+ grid : IgxGridComponent ;
793
+
794
+ @ViewChild ( 'firstColGroup' , { read : IgxColumnGroupComponent } )
795
+ firstColGroup : IgxColumnGroupComponent ;
796
+
797
+ @ViewChild ( 'secondColGroup' , { read : IgxColumnGroupComponent } )
798
+ secondColGroup : IgxColumnGroupComponent ;
799
+
800
+ @ViewChild ( 'thirdColGroup' , { read : IgxColumnGroupComponent } )
801
+ thirdColGroup : IgxColumnGroupComponent ;
802
+
803
+ data = DATASOURCE ;
804
+ }
805
+
759
806
@Component ( {
760
807
template : `
761
808
<igx-grid #grid [data]="data" [height]="gridHeight" [columnWidth]="columnWidth">
0 commit comments