From 1f786b9c05c5330480809645c4cd3b549861c720 Mon Sep 17 00:00:00 2001 From: Brian Hann Date: Tue, 3 Feb 2015 09:10:21 -0600 Subject: [PATCH] fix(uiGridHeaderCell): Adjust test width measure @PaulL1's recent alteration to the box-sizing of header cells is colliding with how I am measuring widths in a recent test. This change move everything back to $.innerWidth() and counts the border as part of the total size, not as an subtraction from it. --- test/unit/core/directives/uiGridCell.spec.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/test/unit/core/directives/uiGridCell.spec.js b/test/unit/core/directives/uiGridCell.spec.js index 25772b5200..a97c9cafd1 100644 --- a/test/unit/core/directives/uiGridCell.spec.js +++ b/test/unit/core/directives/uiGridCell.spec.js @@ -86,7 +86,7 @@ describe('uiGridCell', function () { })); }); - it('should change a columns class when its uid changes', inject(function (gridUtil, $compile, uiGridConstants) { + it("should change a column's class when its uid changes", inject(function (gridUtil, $compile, uiGridConstants) { // Reset the UIDs (used by columns) so they're fresh and clean gridUtil.resetUids(); @@ -113,8 +113,8 @@ describe('uiGridCell', function () { var class1 = _(firstCol[0].className.split(/\s+/)).find(function(c) { return classRegEx.test(c); }); // The first column should be 100px wide because we said it should be - expect(firstCol.outerWidth()).toEqual(100, 'first cell is 100px'); - expect(firstHeaderCell.innerWidth()).toEqual(99, "header cell is 100px less border"); + expect(firstCol.innerWidth()).toEqual(100, 'first cell is 100px, counting border'); + expect(firstHeaderCell.innerWidth()).toEqual(100, "header cell is 100px, counting border"); // Now swap the columns in the column defs $scope.gridOptions.columnDefs = [{ field: 'age', width: 50 }, { field: 'name', width: 100 }]; @@ -128,14 +128,14 @@ describe('uiGridCell', function () { expect(class2).not.toEqual(class1); // The first column should now be 50px wide - expect(firstColAgain.outerWidth()).toEqual(50, 'first cell again is 50'); - expect(firstHeaderCellAgain.innerWidth()).toEqual(49, 'header cell again is 50px less border'); + expect(firstColAgain.innerWidth()).toEqual(50, 'first cell again is 50px, counting border'); + expect(firstHeaderCellAgain.innerWidth()).toEqual(50, 'header cell again is 50px, counting border'); // ... and the last column should now be 100px wide var lastCol = $(gridElm).find('.ui-grid-cell').last(); var lastHeaderCell = $(gridElm).find('.ui-grid-header-cell').last(); - expect(lastCol.outerWidth()).toEqual(100, 'last cell again is 100px'); - expect(lastHeaderCell.innerWidth()).toEqual(99, 'last header cell again is 100px less border'); + expect(lastCol.innerWidth()).toEqual(100, 'last cell again is 100px, counting border'); + expect(lastHeaderCell.innerWidth()).toEqual(100, 'last header cell again is 100px, counting border'); angular.element(gridElm).remove(); }));