@@ -482,6 +482,51 @@ describe('ui.grid.grouping uiGridGroupingService', function () {
482
482
} ) ;
483
483
} ) ;
484
484
485
+ it ( 'sorts' , function ( ) {
486
+ grid . grouping . groupingHeaderCache = {
487
+ male : {
488
+ row : { treeNode : { state : 'collapsed' } } ,
489
+ children : {
490
+ 22 : { row : { treeNode : { state : 'expanded' } } , children : { } } ,
491
+ 39 : { row : { treeNode : { state : 'collapsed' } } , children : { } }
492
+ }
493
+ } ,
494
+ female : {
495
+ row : { treeNode : { state : 'expanded' } } ,
496
+ children : {
497
+ 23 : { row : { treeNode : { state : 'collapsed' } } , children : { } } ,
498
+ 38 : { row : { treeNode : { state : 'expanded' } } , children : { } }
499
+ }
500
+ }
501
+ } ;
502
+
503
+ spyOn ( grid . api . core . raise , 'sortChanged' ) . andCallThrough ( ) ;
504
+
505
+ grid . api . grouping . setGrouping ( {
506
+ grouping : [
507
+ { field : 'col3' , colName : 'col3' , groupPriority : 0 } ,
508
+ { field : 'col2' , colName : 'col2' , groupPriority : 1 }
509
+ ] ,
510
+ aggregations : [
511
+ { field : 'col1' , colName : 'col1' , aggregation : { type : uiGridGroupingConstants . aggregation . COUNT } }
512
+ ] ,
513
+ rowExpandedStates : {
514
+ male : { state : 'expanded' , children : {
515
+ 22 : { state : 'collapsed' } ,
516
+ 38 : { state : 'expanded' }
517
+ } } ,
518
+ female : { state : 'expanded' , children : {
519
+ 23 : { state : 'expanded' } ,
520
+ 39 : { state : 'collapsed' }
521
+ } }
522
+ }
523
+ } ) ;
524
+
525
+ // Should call sort change twice because we are grouping by two columns
526
+ expect ( grid . api . core . raise . sortChanged . calls . length ) . toEqual ( 2 ) ;
527
+
528
+ } ) ;
529
+
485
530
} ) ;
486
531
487
532
0 commit comments