@@ -9,6 +9,7 @@ import { IgxPivotGridTestBaseComponent, IgxPivotGridTestComplexHierarchyComponen
9
9
import { UIInteractions } from '../../test-utils/ui-interactions.spec' ;
10
10
import { PivotDimensionType } from './pivot-grid.interface' ;
11
11
import { IgxPivotHeaderRowComponent } from './pivot-header-row.component' ;
12
+ import { IgxPivotRowDimensionHeaderComponent } from './pivot-row-dimension-header.component' ;
12
13
const CSS_CLASS_DROP_DOWN_BASE = 'igx-drop-down' ;
13
14
const CSS_CLASS_LIST = 'igx-drop-down__list' ;
14
15
const CSS_CLASS_ITEM = 'igx-drop-down__item' ;
@@ -226,7 +227,9 @@ describe('Basic IgxPivotGrid #pivotGrid', () => {
226
227
const rows = pivotGrid . rowList . toArray ( ) ;
227
228
expect ( rows . length ) . toBe ( 3 ) ;
228
229
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 ) ;
230
233
expect ( rowDimensionHeaders ) . toEqual ( expectedHeaders ) ;
231
234
} ) ;
232
235
@@ -266,16 +269,18 @@ describe('Basic IgxPivotGrid #pivotGrid', () => {
266
269
const rowChip = headerRow . querySelector ( 'igx-chip[id="All"]' ) ;
267
270
rowChip . click ( ) ;
268
271
fixture . detectChanges ( ) ;
269
- let rows = pivotGrid . rowList . toArray ( ) ;
272
+ let rowHeaders = fixture . debugElement . queryAll (
273
+ By . directive ( IgxPivotRowDimensionHeaderComponent ) ) ;
270
274
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 ) ;
272
276
expect ( rowDimensionHeaders ) . toEqual ( expectedOrder ) ;
273
277
274
278
rowChip . click ( ) ;
275
279
fixture . detectChanges ( ) ;
276
- rows = pivotGrid . rowList . toArray ( ) ;
277
280
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 ) ;
279
284
expect ( rowDimensionHeaders ) . toEqual ( expectedOrder ) ;
280
285
} ) ;
281
286
@@ -534,9 +539,6 @@ describe('Basic IgxPivotGrid #pivotGrid', () => {
534
539
expect ( rowChipArea . chipsList . toArray ( ) [ 1 ] ) . toBe ( rowChip1 ) ;
535
540
// check dimension order is updated.
536
541
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' ] ) ;
540
542
} ) ;
541
543
542
544
it ( 'should allow reorder in column chip area.' , ( ) => {
@@ -781,8 +783,10 @@ describe('IgxPivotGrid complex hierarchy #pivotGrid', () => {
781
783
const pivotGrid = fixture . componentInstance . pivotGrid ;
782
784
const pivotRows = GridFunctions . getPivotRows ( fixture ) ;
783
785
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 ( ) ;
786
790
fixture . detectChanges ( ) ;
787
791
expect ( row . selected ) . toBeTrue ( ) ;
788
792
expect ( pivotGrid . selectedRows ) . not . toBeNull ( ) ;
@@ -798,7 +802,7 @@ describe('IgxPivotGrid complex hierarchy #pivotGrid', () => {
798
802
expect ( pivotGrid . selectedRows [ 0 ] ) . toEqual ( expected ) ;
799
803
800
804
//deselect
801
- headers [ 1 ] . click ( ) ;
805
+ secondDimCell . nativeElement . click ( ) ;
802
806
fixture . detectChanges ( ) ;
803
807
expect ( row . selected ) . toBeFalse ( ) ;
804
808
expect ( pivotGrid . selectedRows . length ) . toBe ( 0 ) ;
@@ -809,8 +813,10 @@ describe('IgxPivotGrid complex hierarchy #pivotGrid', () => {
809
813
const pivotGrid = fixture . componentInstance . pivotGrid ;
810
814
const pivotRows = GridFunctions . getPivotRows ( fixture ) ;
811
815
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 ( ) ;
814
820
fixture . detectChanges ( ) ;
815
821
for ( let i = 0 ; i < 5 ; ++ i ) {
816
822
expect ( pivotRows [ i ] . componentInstance . selected ) . toBeTrue ( ) ;
0 commit comments