11import { ComponentFixture , fakeAsync , TestBed , tick } from '@angular/core/testing' ;
22import { By } from '@angular/platform-browser' ;
33import { 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' ;
55import { IgxChipsAreaComponent } from '../../chips/chips-area.component' ;
66import { configureTestSuite } from '../../test-utils/configure-suite' ;
77import { GridFunctions , GridSelectionFunctions } from '../../test-utils/grid-functions.spec' ;
@@ -983,30 +983,33 @@ describe('IgxPivotGrid Resizing #pivotGrid', () => {
983983 } ) ) ;
984984
985985 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' ) ) ;
987987
988- let rowHeaders = pivotRows [ 0 ] . queryAll ( By . directive ( IgxPivotRowDimensionHeaderGroupComponent ) ) ;
989- expect ( rowHeaders . length ) . toEqual ( 2 ) ;
988+ let rowHeaders = dimensionContents [ 0 ] . queryAll ( By . directive ( IgxPivotRowDimensionHeaderGroupComponent ) ) ;
990989 expect ( rowHeaders [ 0 ] . componentInstance . column . resizable ) . toBeTrue ( ) ;
991- expect ( rowHeaders [ 1 ] . componentInstance . column . resizable ) . toBeTrue ( ) ;
990+ expect ( rowHeaders [ 3 ] . componentInstance . column . resizable ) . toBeTrue ( ) ;
992991
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 ) ) ;
998993 expect ( rowHeaders [ 0 ] . componentInstance . column . resizable ) . toBeTrue ( ) ;
999994 expect ( rowHeaders [ 1 ] . componentInstance . column . resizable ) . toBeTrue ( ) ;
995+ expect ( rowHeaders [ 5 ] . componentInstance . column . resizable ) . toBeTrue ( ) ;
996+ expect ( rowHeaders [ 7 ] . componentInstance . column . resizable ) . toBeTrue ( ) ;
1000997 } ) ) ;
1001998
1002999 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' ) ) ;
10041001
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 ) ) ;
10071007 expect ( rowHeaders [ 0 ] . componentInstance . column . width ) . toEqual ( '200px' ) ;
10081008 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' ) ;
10091011
1012+ rowHeaders = dimensionContents [ 0 ] . queryAll ( By . directive ( IgxPivotRowDimensionHeaderGroupComponent ) ) ;
10101013 const headerResArea = GridFunctions . getHeaderResizeArea ( rowHeaders [ 0 ] ) . nativeElement ;
10111014
10121015 // Resize first column
@@ -1020,27 +1023,25 @@ describe('IgxPivotGrid Resizing #pivotGrid', () => {
10201023 UIInteractions . simulateMouseEvent ( 'mouseup' , resizer , 300 , 5 ) ;
10211024 fixture . detectChanges ( ) ;
10221025
1026+ rowHeaders = dimensionContents [ 0 ] . queryAll ( By . directive ( IgxPivotRowDimensionHeaderGroupComponent ) ) ;
10231027 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' ) ;
10291029
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 ' ) ;
10321032 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' ) ;
10331035 } ) ) ;
10341036
10351037 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' ) ) ;
10371039
1038- let rowHeaders = pivotRows [ 7 ] . queryAll ( By . directive ( IgxPivotRowDimensionHeaderGroupComponent ) ) ;
1039- expect ( rowHeaders . length ) . toEqual ( 2 ) ;
1040+ let rowHeaders = dimensionContents [ 0 ] . queryAll ( By . directive ( IgxPivotRowDimensionHeaderGroupComponent ) ) ;
10401041 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' ) ;
10421043
1043- const headerResArea = GridFunctions . getHeaderResizeArea ( rowHeaders [ 0 ] ) . nativeElement ;
1044+ const headerResArea = GridFunctions . getHeaderResizeArea ( rowHeaders [ 3 ] ) . nativeElement ;
10441045
10451046 // Resize first column
10461047 UIInteractions . simulateMouseEvent ( 'mousedown' , headerResArea , 100 , 0 ) ;
@@ -1053,15 +1054,14 @@ describe('IgxPivotGrid Resizing #pivotGrid', () => {
10531054 UIInteractions . simulateMouseEvent ( 'mouseup' , resizer , 300 , 5 ) ;
10541055 fixture . detectChanges ( ) ;
10551056
1057+ rowHeaders = dimensionContents [ 0 ] . queryAll ( By . directive ( IgxPivotRowDimensionHeaderGroupComponent ) ) ;
10561058 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' ) ;
10621060
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 ' ) ;
10651063 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' ) ;
10661066 } ) ) ;
10671067} ) ;
0 commit comments