@@ -28,13 +28,21 @@ describe('ui.grid.grouping uiGridGroupingService', function () {
28
28
{ field : 'col0' , enableGrouping : true } ,
29
29
{ field : 'col1' , enableGrouping : true } ,
30
30
{ field : 'col2' , enableGrouping : true } ,
31
- { field : 'col3' , enableGrouping : true }
31
+ { field : 'col3' , enableGrouping : true } ,
32
+ { field : 'col4' , enableGrouping : true , type : 'date' }
32
33
] ;
33
34
34
35
uiGridGroupingService . initializeGrid ( grid , $scope ) ;
35
36
var data = [ ] ;
36
37
for ( var i = 0 ; i < 10 ; i ++ ) {
37
- data . push ( { col0 : 'a_' + Math . floor ( i / 4 ) , col1 : 'b_' + Math . floor ( i / 2 ) , col2 : 'c_' + i , col3 : 'd_' + i } ) ;
38
+
39
+ data . push ( {
40
+ col0 : 'a_' + Math . floor ( i / 4 ) ,
41
+ col1 : 'b_' + Math . floor ( i / 2 ) ,
42
+ col2 : 'c_' + i ,
43
+ col3 : 'd_' + i ,
44
+ col4 : i > 5 ? new Date ( 2015 , 6 , 1 ) : null
45
+ } ) ;
38
46
}
39
47
grid . options . data = data ;
40
48
@@ -83,6 +91,15 @@ describe('ui.grid.grouping uiGridGroupingService', function () {
83
91
var groupedRows = uiGridGroupingService . groupRows . call ( grid , grid . rows . slice ( 0 ) ) ;
84
92
expect ( groupedRows . length ) . toEqual ( 18 , 'all rows are present, including the added group headers' ) ;
85
93
} ) ;
94
+
95
+ it ( 'group by col4 (type date with nulls)' , function ( ) {
96
+ spyOn ( gridClassFactory , 'rowTemplateAssigner' ) . andCallFake ( function ( ) { } ) ;
97
+ grid . columns [ 4 ] . grouping = { groupPriority : 1 } ;
98
+
99
+ uiGridGroupingService . tidyPriorities ( grid ) ;
100
+ var groupedRows = uiGridGroupingService . groupRows . call ( grid , grid . rows . slice ( 0 ) ) ;
101
+ expect ( groupedRows . length ) . toEqual ( 12 , 'all rows are present, including two group header rows' ) ;
102
+ } ) ;
86
103
} ) ;
87
104
88
105
describe ( 'initialiseProcessingState' , function ( ) {
0 commit comments