1
1
import { ComponentFixture , fakeAsync , TestBed , tick } from '@angular/core/testing' ;
2
2
import { By } from '@angular/platform-browser' ;
3
3
import { NoopAnimationsModule } from '@angular/platform-browser/animations' ;
4
- import { FilteringExpressionsTree , FilteringLogic , IgxPivotDateDimension , IgxPivotGridComponent , IgxPivotGridModule , IgxPivotRowComponent , IgxPivotRowDimensionHeaderGroupComponent , IgxStringFilteringOperand } from 'igniteui-angular' ;
4
+ import { FilteringExpressionsTree , FilteringLogic , IgxPivotDateDimension , IgxPivotGridComponent , IgxPivotGridModule , IgxPivotRowComponent , IgxPivotRowDimensionContentComponent , IgxPivotRowDimensionHeaderGroupComponent , IgxStringFilteringOperand } from 'igniteui-angular' ;
5
5
import { IgxChipsAreaComponent } from '../../chips/chips-area.component' ;
6
6
import { configureTestSuite } from '../../test-utils/configure-suite' ;
7
7
import { GridFunctions , GridSelectionFunctions } from '../../test-utils/grid-functions.spec' ;
@@ -983,30 +983,33 @@ describe('IgxPivotGrid Resizing #pivotGrid', () => {
983
983
} ) ) ;
984
984
985
985
it ( 'should define grid with resizable columns.' , fakeAsync ( ( ) => {
986
- let pivotRows = fixture . debugElement . queryAll ( By . directive ( IgxPivotRowComponent ) ) ;
986
+ let dimensionContents = fixture . debugElement . queryAll ( By . css ( '.igx-grid__tbody-pivot-dimension' ) ) ;
987
987
988
- let rowHeaders = pivotRows [ 0 ] . queryAll ( By . directive ( IgxPivotRowDimensionHeaderGroupComponent ) ) ;
989
- expect ( rowHeaders . length ) . toEqual ( 2 ) ;
988
+ let rowHeaders = dimensionContents [ 0 ] . queryAll ( By . directive ( IgxPivotRowDimensionHeaderGroupComponent ) ) ;
990
989
expect ( rowHeaders [ 0 ] . componentInstance . column . resizable ) . toBeTrue ( ) ;
991
- expect ( rowHeaders [ 1 ] . componentInstance . column . resizable ) . toBeTrue ( ) ;
990
+ expect ( rowHeaders [ 3 ] . componentInstance . column . resizable ) . toBeTrue ( ) ;
992
991
993
- rowHeaders = pivotRows [ 3 ] . queryAll ( By . directive ( IgxPivotRowDimensionHeaderGroupComponent ) ) ;
994
- expect ( rowHeaders [ 0 ] . componentInstance . column . resizable ) . toBeTrue ( ) ;
995
- expect ( rowHeaders [ 1 ] . componentInstance . column . resizable ) . toBeTrue ( ) ;
996
-
997
- rowHeaders = pivotRows [ 7 ] . queryAll ( By . directive ( IgxPivotRowDimensionHeaderGroupComponent ) ) ;
992
+ rowHeaders = dimensionContents [ 1 ] . queryAll ( By . directive ( IgxPivotRowDimensionHeaderGroupComponent ) ) ;
998
993
expect ( rowHeaders [ 0 ] . componentInstance . column . resizable ) . toBeTrue ( ) ;
999
994
expect ( rowHeaders [ 1 ] . componentInstance . column . resizable ) . toBeTrue ( ) ;
995
+ expect ( rowHeaders [ 5 ] . componentInstance . column . resizable ) . toBeTrue ( ) ;
996
+ expect ( rowHeaders [ 7 ] . componentInstance . column . resizable ) . toBeTrue ( ) ;
1000
997
} ) ) ;
1001
998
1002
999
it ( 'should update grid after resizing a top dimension header to be bigger.' , fakeAsync ( ( ) => {
1003
- let pivotRows = fixture . debugElement . queryAll ( By . directive ( IgxPivotRowComponent ) ) ;
1000
+ let dimensionContents = fixture . debugElement . queryAll ( By . css ( '.igx-grid__tbody-pivot-dimension' ) ) ;
1004
1001
1005
- let rowHeaders = pivotRows [ 0 ] . queryAll ( By . directive ( IgxPivotRowDimensionHeaderGroupComponent ) ) ;
1006
- expect ( rowHeaders . length ) . toEqual ( 2 ) ;
1002
+ let rowHeaders = dimensionContents [ 0 ] . queryAll ( By . directive ( IgxPivotRowDimensionHeaderGroupComponent ) ) ;
1003
+ expect ( rowHeaders [ 0 ] . componentInstance . column . width ) . toEqual ( '200px' ) ;
1004
+ expect ( rowHeaders [ 3 ] . componentInstance . column . width ) . toEqual ( '200px' ) ;
1005
+
1006
+ rowHeaders = dimensionContents [ 1 ] . queryAll ( By . directive ( IgxPivotRowDimensionHeaderGroupComponent ) ) ;
1007
1007
expect ( rowHeaders [ 0 ] . componentInstance . column . width ) . toEqual ( '200px' ) ;
1008
1008
expect ( rowHeaders [ 1 ] . componentInstance . column . width ) . toEqual ( '200px' ) ;
1009
+ expect ( rowHeaders [ 5 ] . componentInstance . column . width ) . toEqual ( '200px' ) ;
1010
+ expect ( rowHeaders [ 7 ] . componentInstance . column . width ) . toEqual ( '200px' ) ;
1009
1011
1012
+ rowHeaders = dimensionContents [ 0 ] . queryAll ( By . directive ( IgxPivotRowDimensionHeaderGroupComponent ) ) ;
1010
1013
const headerResArea = GridFunctions . getHeaderResizeArea ( rowHeaders [ 0 ] ) . nativeElement ;
1011
1014
1012
1015
// Resize first column
@@ -1020,27 +1023,25 @@ describe('IgxPivotGrid Resizing #pivotGrid', () => {
1020
1023
UIInteractions . simulateMouseEvent ( 'mouseup' , resizer , 300 , 5 ) ;
1021
1024
fixture . detectChanges ( ) ;
1022
1025
1026
+ rowHeaders = dimensionContents [ 0 ] . queryAll ( By . directive ( IgxPivotRowDimensionHeaderGroupComponent ) ) ;
1023
1027
expect ( rowHeaders [ 0 ] . componentInstance . column . width ) . toEqual ( '400px' ) ;
1024
- expect ( rowHeaders [ 1 ] . componentInstance . column . width ) . toEqual ( '200px' ) ;
1025
-
1026
- rowHeaders = pivotRows [ 3 ] . queryAll ( By . directive ( IgxPivotRowDimensionHeaderGroupComponent ) ) ;
1027
- expect ( rowHeaders [ 0 ] . componentInstance . column . width ) . toEqual ( '400px' ) ;
1028
- expect ( rowHeaders [ 1 ] . componentInstance . column . width ) . toEqual ( '200px' ) ;
1028
+ expect ( rowHeaders [ 3 ] . componentInstance . column . width ) . toEqual ( '400px' ) ;
1029
1029
1030
- rowHeaders = pivotRows [ 7 ] . queryAll ( By . directive ( IgxPivotRowDimensionHeaderGroupComponent ) ) ;
1031
- expect ( rowHeaders [ 0 ] . componentInstance . column . width ) . toEqual ( '400px ' ) ;
1030
+ rowHeaders = dimensionContents [ 1 ] . queryAll ( By . directive ( IgxPivotRowDimensionHeaderGroupComponent ) ) ;
1031
+ expect ( rowHeaders [ 0 ] . componentInstance . column . width ) . toEqual ( '200px ' ) ;
1032
1032
expect ( rowHeaders [ 1 ] . componentInstance . column . width ) . toEqual ( '200px' ) ;
1033
+ expect ( rowHeaders [ 5 ] . componentInstance . column . width ) . toEqual ( '200px' ) ;
1034
+ expect ( rowHeaders [ 7 ] . componentInstance . column . width ) . toEqual ( '200px' ) ;
1033
1035
} ) ) ;
1034
1036
1035
1037
it ( 'should update grid after resizing a child dimension header to be bigger.' , fakeAsync ( ( ) => {
1036
- let pivotRows = fixture . debugElement . queryAll ( By . directive ( IgxPivotRowComponent ) ) ;
1038
+ let dimensionContents = fixture . debugElement . queryAll ( By . css ( '.igx-grid__tbody-pivot-dimension' ) ) ;
1037
1039
1038
- let rowHeaders = pivotRows [ 7 ] . queryAll ( By . directive ( IgxPivotRowDimensionHeaderGroupComponent ) ) ;
1039
- expect ( rowHeaders . length ) . toEqual ( 2 ) ;
1040
+ let rowHeaders = dimensionContents [ 0 ] . queryAll ( By . directive ( IgxPivotRowDimensionHeaderGroupComponent ) ) ;
1040
1041
expect ( rowHeaders [ 0 ] . componentInstance . column . width ) . toEqual ( '200px' ) ;
1041
- expect ( rowHeaders [ 1 ] . componentInstance . column . width ) . toEqual ( '200px' ) ;
1042
+ expect ( rowHeaders [ 3 ] . componentInstance . column . width ) . toEqual ( '200px' ) ;
1042
1043
1043
- const headerResArea = GridFunctions . getHeaderResizeArea ( rowHeaders [ 0 ] ) . nativeElement ;
1044
+ const headerResArea = GridFunctions . getHeaderResizeArea ( rowHeaders [ 3 ] ) . nativeElement ;
1044
1045
1045
1046
// Resize first column
1046
1047
UIInteractions . simulateMouseEvent ( 'mousedown' , headerResArea , 100 , 0 ) ;
@@ -1053,15 +1054,14 @@ describe('IgxPivotGrid Resizing #pivotGrid', () => {
1053
1054
UIInteractions . simulateMouseEvent ( 'mouseup' , resizer , 300 , 5 ) ;
1054
1055
fixture . detectChanges ( ) ;
1055
1056
1057
+ rowHeaders = dimensionContents [ 0 ] . queryAll ( By . directive ( IgxPivotRowDimensionHeaderGroupComponent ) ) ;
1056
1058
expect ( rowHeaders [ 0 ] . componentInstance . column . width ) . toEqual ( '400px' ) ;
1057
- expect ( rowHeaders [ 1 ] . componentInstance . column . width ) . toEqual ( '200px' ) ;
1058
-
1059
- rowHeaders = pivotRows [ 0 ] . queryAll ( By . directive ( IgxPivotRowDimensionHeaderGroupComponent ) ) ;
1060
- expect ( rowHeaders [ 0 ] . componentInstance . column . width ) . toEqual ( '400px' ) ;
1061
- expect ( rowHeaders [ 1 ] . componentInstance . column . width ) . toEqual ( '200px' ) ;
1059
+ expect ( rowHeaders [ 3 ] . componentInstance . column . width ) . toEqual ( '400px' ) ;
1062
1060
1063
- rowHeaders = pivotRows [ 3 ] . queryAll ( By . directive ( IgxPivotRowDimensionHeaderGroupComponent ) ) ;
1064
- expect ( rowHeaders [ 0 ] . componentInstance . column . width ) . toEqual ( '400px ' ) ;
1061
+ rowHeaders = dimensionContents [ 1 ] . queryAll ( By . directive ( IgxPivotRowDimensionHeaderGroupComponent ) ) ;
1062
+ expect ( rowHeaders [ 0 ] . componentInstance . column . width ) . toEqual ( '200px ' ) ;
1065
1063
expect ( rowHeaders [ 1 ] . componentInstance . column . width ) . toEqual ( '200px' ) ;
1064
+ expect ( rowHeaders [ 5 ] . componentInstance . column . width ) . toEqual ( '200px' ) ;
1065
+ expect ( rowHeaders [ 7 ] . componentInstance . column . width ) . toEqual ( '200px' ) ;
1066
1066
} ) ) ;
1067
1067
} ) ;
0 commit comments