Skip to content

Commit 1f786b9

Browse files
committed
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.
1 parent aa52bb1 commit 1f786b9

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

Diff for: test/unit/core/directives/uiGridCell.spec.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ describe('uiGridCell', function () {
8686
}));
8787
});
8888

89-
it('should change a columns class when its uid changes', inject(function (gridUtil, $compile, uiGridConstants) {
89+
it("should change a column's class when its uid changes", inject(function (gridUtil, $compile, uiGridConstants) {
9090
// Reset the UIDs (used by columns) so they're fresh and clean
9191
gridUtil.resetUids();
9292

@@ -113,8 +113,8 @@ describe('uiGridCell', function () {
113113
var class1 = _(firstCol[0].className.split(/\s+/)).find(function(c) { return classRegEx.test(c); });
114114

115115
// The first column should be 100px wide because we said it should be
116-
expect(firstCol.outerWidth()).toEqual(100, 'first cell is 100px');
117-
expect(firstHeaderCell.innerWidth()).toEqual(99, "header cell is 100px less border");
116+
expect(firstCol.innerWidth()).toEqual(100, 'first cell is 100px, counting border');
117+
expect(firstHeaderCell.innerWidth()).toEqual(100, "header cell is 100px, counting border");
118118

119119
// Now swap the columns in the column defs
120120
$scope.gridOptions.columnDefs = [{ field: 'age', width: 50 }, { field: 'name', width: 100 }];
@@ -128,14 +128,14 @@ describe('uiGridCell', function () {
128128
expect(class2).not.toEqual(class1);
129129

130130
// The first column should now be 50px wide
131-
expect(firstColAgain.outerWidth()).toEqual(50, 'first cell again is 50');
132-
expect(firstHeaderCellAgain.innerWidth()).toEqual(49, 'header cell again is 50px less border');
131+
expect(firstColAgain.innerWidth()).toEqual(50, 'first cell again is 50px, counting border');
132+
expect(firstHeaderCellAgain.innerWidth()).toEqual(50, 'header cell again is 50px, counting border');
133133

134134
// ... and the last column should now be 100px wide
135135
var lastCol = $(gridElm).find('.ui-grid-cell').last();
136136
var lastHeaderCell = $(gridElm).find('.ui-grid-header-cell').last();
137-
expect(lastCol.outerWidth()).toEqual(100, 'last cell again is 100px');
138-
expect(lastHeaderCell.innerWidth()).toEqual(99, 'last header cell again is 100px less border');
137+
expect(lastCol.innerWidth()).toEqual(100, 'last cell again is 100px, counting border');
138+
expect(lastHeaderCell.innerWidth()).toEqual(100, 'last header cell again is 100px, counting border');
139139

140140
angular.element(gridElm).remove();
141141
}));

0 commit comments

Comments
 (0)