Skip to content

Commit 66a2549

Browse files
author
Alain Dumesny
authored
Merge pull request #1070 from adumesny/develop
reverted #1047 (updating styles)
2 parents 2631f71 + 47c5a32 commit 66a2549

File tree

3 files changed

+30
-21
lines changed

3 files changed

+30
-21
lines changed

doc/CHANGES.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,12 @@ Change log
2525

2626
## v0.5.3-dev (upcoming changes)
2727

28+
- fix for griditems with x=0 placement wrong order (introduced for #1017) ([#1054](https://github.com/gridstack/gridstack.js/issues/1054)).
29+
- fix `cellHeight(val)` not working due to style change caused by #937 fix ([#1068](https://github.com/gridstack/gridstack.js/issues/1068)).
2830
- add `gridstack.poly.js` for IE and older browsers, removed `core-js` lib from samples (<1k vs 85k), and all IE8 mentions ([#1061](https://github.com/gridstack/gridstack.js/pull/1061)).
2931
- add `jquery-ui.js` (and min.js) as minimal subset we need (55k vs 248k), which is now part of `gridstack.all.js`. Include individual parts if you need your own lib instead of all.js
3032
([#1064](https://github.com/gridstack/gridstack.js/pull/1064)).
3133
- changed jquery dependency to lowest we can use (>=1.8) ([#629](https://github.com/gridstack/gridstack.js/issues/629)).
32-
- fix for griditems with x=0 placement wrong order (introduced for #1017) ([#1054](https://github.com/gridstack/gridstack.js/issues/1054)).
3334

3435
## v0.5.3 (2019-11-20)
3536

spec/gridstack-spec.js

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -247,27 +247,35 @@ describe('gridstack', function() {
247247
afterEach(function() {
248248
document.body.removeChild(document.getElementById('gs-cont'));
249249
});
250-
it('should have no changes', function() {
250+
it('should start at 80 then become 120', function() {
251+
var cellHeight = 80;
252+
var verticalMargin = 10;
251253
var options = {
252-
cellHeight: 80,
253-
verticalMargin: 10,
254+
cellHeight: cellHeight,
255+
verticalMargin: verticalMargin,
254256
column: 12
255257
};
256258
$('.grid-stack').gridstack(options);
257-
var grid = $('.grid-stack').data('gridstack');
258-
grid.cellHeight( grid.cellHeight() );
259-
expect(grid.cellHeight()).toBe(80);
260-
});
261-
it('should change cellHeight to 120', function() {
262-
var options = {
263-
cellHeight: 80,
264-
verticalMargin: 10,
265-
column: 10
266-
};
267-
$('.grid-stack').gridstack(options);
268-
var grid = $('.grid-stack').data('gridstack');
269-
grid.cellHeight( 120 );
270-
expect(grid.cellHeight()).toBe(120);
259+
var container = $('.grid-stack');
260+
var grid = container.data('gridstack');
261+
var rows = container.attr('data-gs-current-height');
262+
263+
expect(grid.cellHeight()).toBe(cellHeight);
264+
expect(parseInt(container.css('height'))).toBe(rows * cellHeight + (rows-1) * verticalMargin);
265+
266+
grid.cellHeight( grid.cellHeight() ); // should be no-op
267+
expect(grid.cellHeight()).toBe(cellHeight);
268+
expect(parseInt(container.css('height'))).toBe(rows * cellHeight + (rows-1) * verticalMargin);
269+
270+
cellHeight = 120; // should change and CSS actual height
271+
grid.cellHeight( cellHeight );
272+
expect(grid.cellHeight()).toBe(cellHeight);
273+
expect(parseInt(container.css('height'))).toBe(rows * cellHeight + (rows-1) * verticalMargin);
274+
275+
cellHeight = 20; // should change and CSS actual height
276+
grid.cellHeight( cellHeight );
277+
expect(grid.cellHeight()).toBe(cellHeight);
278+
expect(parseInt(container.css('height'))).toBe(rows * cellHeight + (rows-1) * verticalMargin);
271279
});
272280
});
273281

src/gridstack.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1091,14 +1091,14 @@
10911091
maxHeight = this._styles._max;
10921092
}
10931093

1094-
if (this._styles._max !== 0 && maxHeight <= this._styles._max) { // Keep this._styles._max increasing
1095-
return ;
1096-
}
10971094
this._initStyles();
10981095
this._updateContainerHeight();
10991096
if (!this.opts.cellHeight) { // The rest will be handled by CSS
11001097
return ;
11011098
}
1099+
if (this._styles._max !== 0 && maxHeight <= this._styles._max) { // Keep this._styles._max increasing
1100+
return ;
1101+
}
11021102

11031103
if (!this.opts.verticalMargin || this.opts.cellHeightUnit === this.opts.verticalMarginUnit) {
11041104
getHeight = function(nbRows, nbMargins) {

0 commit comments

Comments
 (0)