Skip to content

Commit a7111a1

Browse files
marcelo-portugalmportuga
authored andcommitted
fix: 🐛 ensure viewport height cannot be negative
Closes: #3034
1 parent c9abb8b commit a7111a1

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

packages/cellnav/test/uiGridCellNavService.spec.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ describe('ui.grid.edit uiGridCellNavService', function() {
201201
$timeout.flush();
202202

203203
expect(args.grid).toEqual(grid);
204-
expect(Math.round(args.y.percentage * 10) / 10).toBe(0.4);
204+
expect(Math.round(args.y.percentage * 10) / 10).toBe(0.5);
205205
expect(isNaN(args.x.percentage)).toEqual(true);
206206
});
207207

@@ -233,7 +233,7 @@ describe('ui.grid.edit uiGridCellNavService', function() {
233233
});
234234
$timeout.flush();
235235

236-
expect(Math.round(args.y.percentage * 10) / 10).toEqual(0.5);
236+
expect(Math.round(args.y.percentage * 10) / 10).toEqual(0.6);
237237
expect(args.x).toBe(null);
238238
});
239239

packages/core/src/js/factories/Grid.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1685,7 +1685,7 @@ angular.module('ui.grid')
16851685

16861686
// gridUtil.logDebug('viewPortHeight', viewPortHeight);
16871687

1688-
return viewPortHeight;
1688+
return viewPortHeight > 0 ? viewPortHeight : 0;
16891689
};
16901690

16911691
Grid.prototype.getViewportWidth = function getViewportWidth() {

packages/core/src/js/factories/GridRenderContainer.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ angular.module('ui.grid')
229229

230230
viewPortHeight = viewPortHeight + adjustment.height;
231231

232-
return viewPortHeight;
232+
return viewPortHeight > 0 ? viewPortHeight : 0;
233233
};
234234

235235
GridRenderContainer.prototype.getViewportWidth = function getViewportWidth() {

0 commit comments

Comments
 (0)