1
1
describe ( 'Grid factory' , function ( ) {
2
- var $timeout , $q , $scope , grid , Grid , GridRow , GridColumn , rows , returnedRows , column , uiGridConstants , gridClassFactory ;
2
+ var $timeout , $q , $scope , grid , Grid , GridRow , GridColumn , rows , returnedRows , column , uiGridConstants ,
3
+ gridClassFactory , gridUtil ;
3
4
4
5
beforeEach ( function ( ) {
5
6
module ( 'ui.grid' ) ;
6
7
7
- inject ( function ( _$timeout_ , _$q_ , _$rootScope_ , _Grid_ , _GridRow_ , _GridColumn_ , _uiGridConstants_ , _gridClassFactory_ ) {
8
+ inject ( function ( _$timeout_ , _$q_ , _$rootScope_ , _Grid_ , _GridRow_ , _GridColumn_ , _uiGridConstants_ ,
9
+ _gridClassFactory_ , _gridUtil_ ) {
8
10
$timeout = _$timeout_ ;
9
11
$q = _$q_ ;
10
12
$scope = _$rootScope_ ;
@@ -13,6 +15,7 @@ describe('Grid factory', function () {
13
15
GridColumn = _GridColumn_ ;
14
16
uiGridConstants = _uiGridConstants_ ;
15
17
gridClassFactory = _gridClassFactory_ ;
18
+ gridUtil = _gridUtil_ ;
16
19
} ) ;
17
20
grid = new Grid ( { id : 1 } ) ;
18
21
rows = [
@@ -47,9 +50,9 @@ describe('Grid factory', function () {
47
50
var canvasWidth = 100 ;
48
51
49
52
beforeEach ( function ( ) {
50
- renderContainers = {
51
- body : {
52
- visibleRowCache : null ,
53
+ renderContainers = {
54
+ body : {
55
+ visibleRowCache : null ,
53
56
visibleColumnCache : null ,
54
57
prevScrollTop : prevScrollTop ,
55
58
headerHeight : 30 ,
@@ -99,7 +102,7 @@ describe('Grid factory', function () {
99
102
} ) ;
100
103
101
104
$scope . $apply ( ) ;
102
- } ) ;
105
+ } ) ;
103
106
} ) ;
104
107
105
108
describe ( 'constructor' , function ( ) {
@@ -123,6 +126,32 @@ describe('Grid factory', function () {
123
126
expect ( e ) . toMatch ( / I t m u s t f o l l o w C S S s e l e c t o r s y n t a x r u l e s / ) ;
124
127
}
125
128
} ) ;
129
+ describe ( 'scrollbarHeight and scrollbarWidth' , function ( ) {
130
+ describe ( 'when enableHorizontalScrollbar not equal to NEVER' , function ( ) {
131
+ it ( 'should set scrollbarHeight and scrollbarWidth' , function ( ) {
132
+ var grid = new Grid ( {
133
+ id : 1 ,
134
+ enableHorizontalScrollbar : uiGridConstants . scrollbars . ALWAYS ,
135
+ enableVerticalScrollbar : uiGridConstants . scrollbars . ALWAYS
136
+ } ) ;
137
+
138
+ expect ( grid . scrollbarHeight ) . not . toEqual ( 0 ) ;
139
+ expect ( grid . scrollbarWidth ) . not . toEqual ( 0 ) ;
140
+ } ) ;
141
+ } ) ;
142
+ describe ( 'when enableHorizontalScrollbar is equal to NEVER' , function ( ) {
143
+ it ( 'should set scrollbarHeight and scrollbarWidth to 0' , function ( ) {
144
+ var grid = new Grid ( {
145
+ id : 1 ,
146
+ enableHorizontalScrollbar : uiGridConstants . scrollbars . NEVER ,
147
+ enableVerticalScrollbar : uiGridConstants . scrollbars . NEVER
148
+ } ) ;
149
+
150
+ expect ( grid . scrollbarHeight ) . toEqual ( 0 ) ;
151
+ expect ( grid . scrollbarWidth ) . toEqual ( 0 ) ;
152
+ } ) ;
153
+ } ) ;
154
+ } ) ;
126
155
} ) ;
127
156
128
157
describe ( 'row processors' , function ( ) {
@@ -278,8 +307,6 @@ describe('Grid factory', function () {
278
307
279
308
} ) ;
280
309
281
-
282
-
283
310
describe ( 'buildColumns' , function ( ) {
284
311
it ( 'guess correct column types when not specified' , function ( ) {
285
312
var dataRow = { str :'abc' , num :123 , dat :new Date ( ) , bool :true , obj :{ } , nll :null , negNum :- 1 , posNum :+ 1 } ;
0 commit comments