@@ -9,6 +9,7 @@ import { IgxPivotGridTestBaseComponent, IgxPivotGridTestComplexHierarchyComponen
99import { UIInteractions } from '../../test-utils/ui-interactions.spec' ;
1010import { PivotDimensionType } from './pivot-grid.interface' ;
1111import { IgxPivotHeaderRowComponent } from './pivot-header-row.component' ;
12+ import { IgxPivotRowDimensionHeaderComponent } from './pivot-row-dimension-header.component' ;
1213const CSS_CLASS_DROP_DOWN_BASE = 'igx-drop-down' ;
1314const CSS_CLASS_LIST = 'igx-drop-down__list' ;
1415const CSS_CLASS_ITEM = 'igx-drop-down__item' ;
@@ -226,7 +227,9 @@ describe('Basic IgxPivotGrid #pivotGrid', () => {
226227 const rows = pivotGrid . rowList . toArray ( ) ;
227228 expect ( rows . length ) . toBe ( 3 ) ;
228229 const expectedHeaders = [ 'All' , 'Clothing' , 'Components' ] ;
229- const rowDimensionHeaders = rows . map ( x => x . rowDimension ) . flat ( ) . map ( x => x . header ) ;
230+ const rowHeaders = fixture . debugElement . queryAll (
231+ By . directive ( IgxPivotRowDimensionHeaderComponent ) ) ;
232+ const rowDimensionHeaders = rowHeaders . map ( x => x . componentInstance . column . header ) ;
230233 expect ( rowDimensionHeaders ) . toEqual ( expectedHeaders ) ;
231234 } ) ;
232235
@@ -266,16 +269,18 @@ describe('Basic IgxPivotGrid #pivotGrid', () => {
266269 const rowChip = headerRow . querySelector ( 'igx-chip[id="All"]' ) ;
267270 rowChip . click ( ) ;
268271 fixture . detectChanges ( ) ;
269- let rows = pivotGrid . rowList . toArray ( ) ;
272+ let rowHeaders = fixture . debugElement . queryAll (
273+ By . directive ( IgxPivotRowDimensionHeaderComponent ) ) ;
270274 let expectedOrder = [ 'All' , 'Accessories' , 'Bikes' , 'Clothing' , 'Components' ] ;
271- let rowDimensionHeaders = rows . map ( x => x . rowDimension ) . flat ( ) . map ( x => x . header ) ;
275+ let rowDimensionHeaders = rowHeaders . map ( x => x . componentInstance . column . header ) ;
272276 expect ( rowDimensionHeaders ) . toEqual ( expectedOrder ) ;
273277
274278 rowChip . click ( ) ;
275279 fixture . detectChanges ( ) ;
276- rows = pivotGrid . rowList . toArray ( ) ;
277280 expectedOrder = [ 'All' , 'Components' , 'Clothing' , 'Bikes' , 'Accessories' ] ;
278- rowDimensionHeaders = rows . map ( x => x . rowDimension ) . flat ( ) . map ( x => x . header ) ;
281+ rowHeaders = fixture . debugElement . queryAll (
282+ By . directive ( IgxPivotRowDimensionHeaderComponent ) ) ;
283+ rowDimensionHeaders = rowHeaders . map ( x => x . componentInstance . column . header ) ;
279284 expect ( rowDimensionHeaders ) . toEqual ( expectedOrder ) ;
280285 } ) ;
281286
@@ -534,9 +539,6 @@ describe('Basic IgxPivotGrid #pivotGrid', () => {
534539 expect ( rowChipArea . chipsList . toArray ( ) [ 1 ] ) . toBe ( rowChip1 ) ;
535540 // check dimension order is updated.
536541 expect ( pivotGrid . pivotConfiguration . rows . map ( x => x . memberName ) ) . toEqual ( [ 'SellerName' , 'ProductCategory' ] ) ;
537- // check rows reflect new order of dims
538- expect ( pivotGrid . gridAPI . get_row_by_index ( 0 ) . rowDimensionData . map ( x => x . dimension . memberName ) )
539- . toEqual ( [ 'SellerName' , 'ProductCategory' ] ) ;
540542 } ) ;
541543
542544 it ( 'should allow reorder in column chip area.' , ( ) => {
@@ -781,8 +783,10 @@ describe('IgxPivotGrid complex hierarchy #pivotGrid', () => {
781783 const pivotGrid = fixture . componentInstance . pivotGrid ;
782784 const pivotRows = GridFunctions . getPivotRows ( fixture ) ;
783785 const row = pivotRows [ 2 ] . componentInstance ;
784- const headers = row . nativeElement . querySelectorAll ( 'igx-pivot-row-dimension-header-group' ) ;
785- headers [ 1 ] . click ( ) ;
786+ const rowHeaders = fixture . debugElement . queryAll (
787+ By . directive ( IgxPivotRowDimensionHeaderComponent ) ) ;
788+ const secondDimCell = rowHeaders . find ( x => x . componentInstance . column . header === 'Clothing' ) ;
789+ secondDimCell . nativeElement . click ( ) ;
786790 fixture . detectChanges ( ) ;
787791 expect ( row . selected ) . toBeTrue ( ) ;
788792 expect ( pivotGrid . selectedRows ) . not . toBeNull ( ) ;
@@ -798,7 +802,7 @@ describe('IgxPivotGrid complex hierarchy #pivotGrid', () => {
798802 expect ( pivotGrid . selectedRows [ 0 ] ) . toEqual ( expected ) ;
799803
800804 //deselect
801- headers [ 1 ] . click ( ) ;
805+ secondDimCell . nativeElement . click ( ) ;
802806 fixture . detectChanges ( ) ;
803807 expect ( row . selected ) . toBeFalse ( ) ;
804808 expect ( pivotGrid . selectedRows . length ) . toBe ( 0 ) ;
@@ -809,8 +813,10 @@ describe('IgxPivotGrid complex hierarchy #pivotGrid', () => {
809813 const pivotGrid = fixture . componentInstance . pivotGrid ;
810814 const pivotRows = GridFunctions . getPivotRows ( fixture ) ;
811815 const row = pivotRows [ 2 ] . componentInstance ;
812- const headers = row . nativeElement . querySelectorAll ( 'igx-pivot-row-dimension-header-group' ) ;
813- headers [ 0 ] . click ( ) ;
816+ const rowHeaders = fixture . debugElement . queryAll (
817+ By . directive ( IgxPivotRowDimensionHeaderComponent ) ) ;
818+ const firstDimCell = rowHeaders . find ( x => x . componentInstance . column . header === 'All Cities' ) ;
819+ firstDimCell . nativeElement . click ( ) ;
814820 fixture . detectChanges ( ) ;
815821 for ( let i = 0 ; i < 5 ; ++ i ) {
816822 expect ( pivotRows [ i ] . componentInstance . selected ) . toBeTrue ( ) ;
0 commit comments