@@ -5,16 +5,16 @@ describe('gridstack', function() {
5
5
var w ;
6
6
var gridstackHTML =
7
7
'<div class="grid-stack">' +
8
+ ' <div class="grid-stack-item"' +
9
+ ' data-gs-x="0" data-gs-y="0"' +
10
+ ' data-gs-width="4" data-gs-height="2">' +
11
+ ' <div class="grid-stack-item-content"></div>' +
12
+ ' </div>' +
8
13
' <div class="grid-stack-item"' +
9
- ' data-gs-x="0 " data-gs-y="0"' +
10
- ' data-gs-width="4" data-gs-height="2 ">' +
11
- ' <div class="grid-stack-item-content"></div>' +
14
+ ' data-gs-x="4 " data-gs-y="0"' +
15
+ ' data-gs-width="4" data-gs-height="4 ">' +
16
+ ' <div class="grid-stack-item-content"></div>' +
12
17
' </div>' +
13
- ' <div class="grid-stack-item"' +
14
- ' data-gs-x="4" data-gs-y="0"' +
15
- ' data-gs-width="4" data-gs-height="4">' +
16
- ' <div class="grid-stack-item-content"></div>' +
17
- ' </div>' +
18
18
'</div>' ;
19
19
20
20
beforeEach ( function ( ) {
@@ -244,6 +244,38 @@ describe('gridstack', function() {
244
244
} ) ;
245
245
} ) ;
246
246
247
+ describe ( 'grid.cellHeight' , function ( ) {
248
+ beforeEach ( function ( ) {
249
+ document . body . insertAdjacentHTML (
250
+ 'afterbegin' , gridstackHTML ) ;
251
+ } ) ;
252
+ afterEach ( function ( ) {
253
+ document . body . removeChild ( document . getElementsByClassName ( 'grid-stack' ) [ 0 ] ) ;
254
+ } ) ;
255
+ it ( 'should have no changes' , function ( ) {
256
+ var options = {
257
+ cellHeight : 80 ,
258
+ verticalMargin : 10 ,
259
+ width : 12
260
+ } ;
261
+ $ ( '.grid-stack' ) . gridstack ( options ) ;
262
+ var grid = $ ( '.grid-stack' ) . data ( 'gridstack' ) ;
263
+ grid . cellHeight ( grid . cellHeight ( ) ) ;
264
+ expect ( grid . cellHeight ( ) ) . toBe ( 80 ) ;
265
+ } ) ;
266
+ it ( 'should change cellHeight to 120' , function ( ) {
267
+ var options = {
268
+ cellHeight : 80 ,
269
+ verticalMargin : 10 ,
270
+ width : 10
271
+ } ;
272
+ $ ( '.grid-stack' ) . gridstack ( options ) ;
273
+ var grid = $ ( '.grid-stack' ) . data ( 'gridstack' ) ;
274
+ grid . cellHeight ( 120 ) ;
275
+ expect ( grid . cellHeight ( ) ) . toBe ( 120 ) ;
276
+ } ) ;
277
+ } ) ;
278
+
247
279
describe ( 'grid.minWidth' , function ( ) {
248
280
beforeEach ( function ( ) {
249
281
document . body . insertAdjacentHTML (
@@ -838,9 +870,9 @@ describe('gridstack', function() {
838
870
$ ( '.grid-stack' ) . gridstack ( options ) ;
839
871
var grid = $ ( '.grid-stack' ) . data ( 'gridstack' ) ;
840
872
var widgetHTML =
841
- ' <div class="grid-stack-item">' +
842
- ' <div class="grid-stack-item-content"></div>' +
843
- ' </div>' ;
873
+ ' <div class="grid-stack-item">' +
874
+ ' <div class="grid-stack-item-content"></div>' +
875
+ ' </div>' ;
844
876
var widget = grid . addWidget ( widgetHTML , 6 , 7 , 2 , 3 , false , 1 , 4 , 2 , 5 , 'coolWidget' ) ;
845
877
var $widget = $ ( widget ) ;
846
878
expect ( parseInt ( $widget . attr ( 'data-gs-x' ) , 10 ) ) . toBe ( 6 ) ;
@@ -872,9 +904,9 @@ describe('gridstack', function() {
872
904
$ ( '.grid-stack' ) . gridstack ( options ) ;
873
905
var grid = $ ( '.grid-stack' ) . data ( 'gridstack' ) ;
874
906
var widgetHTML =
875
- ' <div class="grid-stack-item">' +
876
- ' <div class="grid-stack-item-content"></div>' +
877
- ' </div>' ;
907
+ ' <div class="grid-stack-item">' +
908
+ ' <div class="grid-stack-item-content"></div>' +
909
+ ' </div>' ;
878
910
var widget = grid . addWidget ( widgetHTML , 9 , 7 , 2 , 3 , true ) ;
879
911
var $widget = $ ( widget ) ;
880
912
expect ( parseInt ( $widget . attr ( 'data-gs-x' ) , 10 ) ) . not . toBe ( 6 ) ;
0 commit comments