@@ -2619,5 +2619,50 @@ describe('IgxPivotGrid #pivotGrid', () => {
2619
2619
expect ( pivotGrid . rowList . length ) . toBe ( 1 ) ;
2620
2620
expect ( pivotGrid . rowList . toArray ( ) [ 0 ] . data . dimensionValues . get ( 'ProductCategory' ) ) . toBe ( 'Bikes' ) ;
2621
2621
} ) ;
2622
+
2623
+ it ( 'should allow setting aggregatorName instead of aggregator.' , ( ) => {
2624
+ const pivotGrid = fixture . componentInstance . pivotGrid ;
2625
+ pivotGrid . pivotConfiguration . values = [
2626
+ {
2627
+ member : 'UnitsSold' ,
2628
+ aggregate : {
2629
+ aggregatorName : 'SUM' ,
2630
+ key : 'SUM' ,
2631
+ label : 'Sum' ,
2632
+ } ,
2633
+ enabled : true
2634
+ }
2635
+ ] ;
2636
+ pivotGrid . notifyDimensionChange ( true ) ;
2637
+ fixture . detectChanges ( ) ;
2638
+ let pivotRecord = ( pivotGrid . rowList . first as IgxPivotRowComponent ) . data ;
2639
+ expect ( pivotRecord . aggregationValues . get ( 'US' ) ) . toBe ( 296 ) ;
2640
+ expect ( pivotRecord . aggregationValues . get ( 'Bulgaria' ) ) . toBe ( 774 ) ;
2641
+ expect ( pivotRecord . aggregationValues . get ( 'UK' ) ) . toBe ( 293 ) ;
2642
+ expect ( pivotRecord . aggregationValues . get ( 'Japan' ) ) . toBe ( 240 ) ;
2643
+ } ) ;
2644
+
2645
+ it ( 'should use aggregatorName if both aggregatorName and aggregator are set at the same time.' , ( ) => {
2646
+ const pivotGrid = fixture . componentInstance . pivotGrid ;
2647
+ pivotGrid . pivotConfiguration . values = [
2648
+ {
2649
+ member : 'UnitsSold' ,
2650
+ aggregate : {
2651
+ aggregatorName : 'SUM' ,
2652
+ aggregator : IgxPivotNumericAggregate . average ,
2653
+ key : 'SUM' ,
2654
+ label : 'Sum' ,
2655
+ } ,
2656
+ enabled : true
2657
+ }
2658
+ ] ;
2659
+ pivotGrid . notifyDimensionChange ( true ) ;
2660
+ fixture . detectChanges ( ) ;
2661
+ let pivotRecord = ( pivotGrid . rowList . first as IgxPivotRowComponent ) . data ;
2662
+ expect ( pivotRecord . aggregationValues . get ( 'US' ) ) . toBe ( 296 ) ;
2663
+ expect ( pivotRecord . aggregationValues . get ( 'Bulgaria' ) ) . toBe ( 774 ) ;
2664
+ expect ( pivotRecord . aggregationValues . get ( 'UK' ) ) . toBe ( 293 ) ;
2665
+ expect ( pivotRecord . aggregationValues . get ( 'Japan' ) ) . toBe ( 240 ) ;
2666
+ } ) ;
2622
2667
} ) ;
2623
2668
} ) ;
0 commit comments