@@ -5,16 +5,16 @@ describe('gridstack', function() {
55 var w ;
66 var gridstackHTML =
77 '<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>' +
813 ' <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>' +
1217 ' </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>' +
1818 '</div>' ;
1919
2020 beforeEach ( function ( ) {
@@ -244,6 +244,38 @@ describe('gridstack', function() {
244244 } ) ;
245245 } ) ;
246246
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+
247279 describe ( 'grid.minWidth' , function ( ) {
248280 beforeEach ( function ( ) {
249281 document . body . insertAdjacentHTML (
@@ -838,9 +870,9 @@ describe('gridstack', function() {
838870 $ ( '.grid-stack' ) . gridstack ( options ) ;
839871 var grid = $ ( '.grid-stack' ) . data ( 'gridstack' ) ;
840872 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>' ;
844876 var widget = grid . addWidget ( widgetHTML , 6 , 7 , 2 , 3 , false , 1 , 4 , 2 , 5 , 'coolWidget' ) ;
845877 var $widget = $ ( widget ) ;
846878 expect ( parseInt ( $widget . attr ( 'data-gs-x' ) , 10 ) ) . toBe ( 6 ) ;
@@ -872,9 +904,9 @@ describe('gridstack', function() {
872904 $ ( '.grid-stack' ) . gridstack ( options ) ;
873905 var grid = $ ( '.grid-stack' ) . data ( 'gridstack' ) ;
874906 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>' ;
878910 var widget = grid . addWidget ( widgetHTML , 9 , 7 , 2 , 3 , true ) ;
879911 var $widget = $ ( widget ) ;
880912 expect ( parseInt ( $widget . attr ( 'data-gs-x' ) , 10 ) ) . not . toBe ( 6 ) ;
0 commit comments