-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
fixed cellHeight() check for no-op return #786
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,16 +5,16 @@ describe('gridstack', function() { | |
| var w; | ||
| var gridstackHTML = | ||
| '<div class="grid-stack">' + | ||
| ' <div class="grid-stack-item"' + | ||
| ' data-gs-x="0" data-gs-y="0"' + | ||
| ' data-gs-width="4" data-gs-height="2">' + | ||
| ' <div class="grid-stack-item-content"></div>' + | ||
| ' </div>' + | ||
| ' <div class="grid-stack-item"' + | ||
| ' data-gs-x="0" data-gs-y="0"' + | ||
| ' data-gs-width="4" data-gs-height="2">' + | ||
| ' <div class="grid-stack-item-content"></div>' + | ||
| ' data-gs-x="4" data-gs-y="0"' + | ||
| ' data-gs-width="4" data-gs-height="4">' + | ||
| ' <div class="grid-stack-item-content"></div>' + | ||
| ' </div>' + | ||
| ' <div class="grid-stack-item"' + | ||
| ' data-gs-x="4" data-gs-y="0"' + | ||
| ' data-gs-width="4" data-gs-height="4">' + | ||
| ' <div class="grid-stack-item-content"></div>' + | ||
| ' </div>' + | ||
| '</div>'; | ||
|
|
||
| beforeEach(function() { | ||
|
|
@@ -244,6 +244,38 @@ describe('gridstack', function() { | |
| }); | ||
| }); | ||
|
|
||
| describe('grid.cellHeight', function() { | ||
| beforeEach(function() { | ||
| document.body.insertAdjacentHTML( | ||
| 'afterbegin', gridstackHTML); | ||
| }); | ||
| afterEach(function() { | ||
| document.body.removeChild(document.getElementsByClassName('grid-stack')[0]); | ||
| }); | ||
| it('should have no changes', function() { | ||
| var options = { | ||
| cellHeight: 80, | ||
| verticalMargin: 10, | ||
| width: 12 | ||
| }; | ||
| $('.grid-stack').gridstack(options); | ||
| var grid = $('.grid-stack').data('gridstack'); | ||
| grid.cellHeight( grid.cellHeight() ); | ||
| expect(grid.cellHeight()).toBe(80); | ||
| }); | ||
| it('should change cellHeight to 120', function() { | ||
| var options = { | ||
| cellHeight: 80, | ||
| verticalMargin: 10, | ||
| width: 10 | ||
| }; | ||
| $('.grid-stack').gridstack(options); | ||
| var grid = $('.grid-stack').data('gridstack'); | ||
| grid.cellHeight( 120 ); | ||
| expect(grid.cellHeight()).toBe(120); | ||
| }); | ||
| }); | ||
|
|
||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. added simple test above to call cellHeight() after the fact to get more coverage. I don't know how to test to make sure grid changes height when increasing row height (80->120) which would fail to work correctly in the nested case (but might be ok otherwise). |
||
| describe('grid.minWidth', function() { | ||
| beforeEach(function() { | ||
| document.body.insertAdjacentHTML( | ||
|
|
@@ -838,9 +870,9 @@ describe('gridstack', function() { | |
| $('.grid-stack').gridstack(options); | ||
| var grid = $('.grid-stack').data('gridstack'); | ||
| var widgetHTML = | ||
| ' <div class="grid-stack-item">' + | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. again indentation fixes. ignore |
||
| ' <div class="grid-stack-item-content"></div>' + | ||
| ' </div>'; | ||
| ' <div class="grid-stack-item">' + | ||
| ' <div class="grid-stack-item-content"></div>' + | ||
| ' </div>'; | ||
| var widget = grid.addWidget(widgetHTML, 6, 7, 2, 3, false, 1, 4, 2, 5, 'coolWidget'); | ||
| var $widget = $(widget); | ||
| expect(parseInt($widget.attr('data-gs-x'), 10)).toBe(6); | ||
|
|
@@ -872,9 +904,9 @@ describe('gridstack', function() { | |
| $('.grid-stack').gridstack(options); | ||
| var grid = $('.grid-stack').data('gridstack'); | ||
| var widgetHTML = | ||
| ' <div class="grid-stack-item">' + | ||
| ' <div class="grid-stack-item-content"></div>' + | ||
| ' </div>'; | ||
| ' <div class="grid-stack-item">' + | ||
| ' <div class="grid-stack-item-content"></div>' + | ||
| ' </div>'; | ||
| var widget = grid.addWidget(widgetHTML, 9, 7, 2, 3, true); | ||
| var $widget = $(widget); | ||
| expect(parseInt($widget.attr('data-gs-x'), 10)).not.toBe(6); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1610,7 +1610,7 @@ | |
| } | ||
| var heightData = Utils.parseHeight(val); | ||
|
|
||
| if (this.opts.cellHeightUnit === heightData.heightUnit && this.opts.height === heightData.height) { | ||
| if (this.opts.cellHeightUnit === heightData.unit && this.opts.cellHeight === heightData.height) { | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. code fix to use actual vars |
||
| return ; | ||
| } | ||
| this.opts.cellHeightUnit = heightData.unit; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
those are just formatting 2 spaces change. ignore.