Skip to content

Commit

Permalink
fix(uiGridHeaderCell): Adjust test width measure
Browse files Browse the repository at this point in the history
@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.
  • Loading branch information
c0bra committed Feb 3, 2015
1 parent aa52bb1 commit 1f786b9
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions test/unit/core/directives/uiGridCell.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand All @@ -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 }];
Expand All @@ -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();
}));
Expand Down

0 comments on commit 1f786b9

Please sign in to comment.