1
1
describe ( 'ui.grid.treeBase uiGridTreeBaseService' , function ( ) {
2
- var uiGridTreeBaseService ;
3
- var uiGridTreeBaseConstants ;
4
- var gridClassFactory ;
5
- var grid ;
6
- var $rootScope ;
7
- var $scope ;
8
- var GridRow ;
9
- var gridUtil ;
10
- var uiGridConstants ;
11
-
12
- beforeEach ( module ( 'ui.grid.treeBase' ) ) ;
13
-
14
- beforeEach ( inject ( function ( _uiGridTreeBaseService_ , _gridClassFactory_ , $templateCache , _uiGridTreeBaseConstants_ ,
15
- _$rootScope_ , _GridRow_ , _gridUtil_ , _uiGridConstants_ ) {
16
- uiGridTreeBaseService = _uiGridTreeBaseService_ ;
17
- uiGridTreeBaseConstants = _uiGridTreeBaseConstants_ ;
18
- gridClassFactory = _gridClassFactory_ ;
19
- $rootScope = _$rootScope_ ;
2
+ var uiGridTreeBaseService ,
3
+ uiGridTreeBaseConstants ,
4
+ gridClassFactory ,
5
+ grid ,
6
+ $rootScope ,
7
+ $scope ,
8
+ GridRow ,
9
+ gridUtil ,
10
+ uiGridConstants ;
11
+
12
+ beforeEach ( function ( ) {
13
+ module ( 'ui.grid.treeBase' ) ;
14
+
15
+ inject ( function ( _uiGridTreeBaseService_ , _gridClassFactory_ , $templateCache , _uiGridTreeBaseConstants_ ,
16
+ _$rootScope_ , _GridRow_ , _gridUtil_ , _uiGridConstants_ ) {
17
+ uiGridTreeBaseService = _uiGridTreeBaseService_ ;
18
+ uiGridTreeBaseConstants = _uiGridTreeBaseConstants_ ;
19
+ gridClassFactory = _gridClassFactory_ ;
20
+ $rootScope = _$rootScope_ ;
21
+ GridRow = _GridRow_ ;
22
+ gridUtil = _gridUtil_ ;
23
+ uiGridConstants = _uiGridConstants_ ;
24
+ } ) ;
20
25
$scope = $rootScope . $new ( ) ;
21
- GridRow = _GridRow_ ;
22
- gridUtil = _gridUtil_ ;
23
- uiGridConstants = _uiGridConstants_ ;
24
26
25
27
grid = gridClassFactory . createGrid ( { } ) ;
26
28
grid . options . columnDefs = [
@@ -30,6 +32,7 @@ describe('ui.grid.treeBase uiGridTreeBaseService', function () {
30
32
{ field : 'col3' }
31
33
] ;
32
34
35
+ spyOn ( grid , 'addRowHeaderColumn' ) . and . callThrough ( ) ;
33
36
uiGridTreeBaseService . initializeGrid ( grid , $scope ) ;
34
37
$scope . $apply ( ) ;
35
38
@@ -44,24 +47,11 @@ describe('ui.grid.treeBase uiGridTreeBaseService', function () {
44
47
data [ 7 ] . $$treeLevel = 0 ;
45
48
data [ 9 ] . $$treeLevel = 1 ;
46
49
47
- // data = [
48
- // { col0: 'a_0', col1: 0, col2: 'c_0', col3: 0, '$$treeLevel': 0 } ,
49
- // { col0: 'a_0', col1: 0, col2: 'c_1', col3: 1, '$$treeLevel': 1 },
50
- // { col0: 'a_0', col1: 1, col2: 'c_2', col3: 2 },
51
- // { col0: 'a_0', col1: 1, col2: 'c_3', col3: 3, '$$treeLevel': 1 },
52
- // { col0: 'a_1', col1: 2, col2: 'c_4', col3: 4, '$$treeLevel': 2 },
53
- // { col0: 'a_1', col1: 2, col2: 'c_5', col3: 5 },
54
- // { col0: 'a_1', col1: 3, col2: 'c_6', col3: 6 },
55
- // { col0: 'a_1', col1: 3, col2: 'c_7', col3: 7, '$$treeLevel': 0 },
56
- // { col0: 'a_2', col1: 4, col2: 'c_8', col3: 8 },
57
- // { col0: 'a_2', col1: 4, col2: 'c_9', col3: 9, '$$treeLevel': 1 }
58
- // ];
59
-
60
50
grid . options . data = data ;
61
51
62
52
grid . buildColumns ( ) ;
63
53
grid . modifyRows ( grid . options . data ) ;
64
- } ) ) ;
54
+ } ) ;
65
55
66
56
67
57
describe ( 'initializeGrid and defaultGridOptions' , function ( ) {
@@ -90,6 +80,9 @@ describe('ui.grid.treeBase uiGridTreeBaseService', function () {
90
80
enableExpandAll : true
91
81
} ) ;
92
82
} ) ;
83
+ it ( 'should call addRowHeaderColumn' , function ( ) {
84
+ expect ( grid . addRowHeaderColumn ) . toHaveBeenCalledWith ( jasmine . any ( Object ) , - 100 , true ) ;
85
+ } ) ;
93
86
} ) ;
94
87
95
88
0 commit comments