Skip to content

Commit 7774d30

Browse files
committed
fix(uiGridHeaderCell): Change test measure method
Previous fix actually didn't fix anything because tests weren't running with the CSS files compiled, as clean was running before single tests, and the less task wasn't running. This change runs less BEFORE the tests run so the CSS is present, this matches the way the `dev` task works.
1 parent 1f786b9 commit 7774d30

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

Diff for: Gruntfile.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -606,7 +606,7 @@ module.exports = function(grunt) {
606606

607607
// register before and after test tasks so we don't have to change cli
608608
// options on the CI server
609-
grunt.registerTask('before-test', ['clean', 'jshint', 'jscs', 'ngtemplates']); // Have to run less so CSS files are present
609+
grunt.registerTask('before-test', ['clean', 'jshint', 'jscs', 'ngtemplates', 'less']); // Have to run less so CSS files are present
610610
grunt.registerTask('after-test', ['build']);
611611

612612
// Default task.

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

+6-6
Original file line numberDiff line numberDiff line change
@@ -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.innerWidth()).toEqual(100, 'first cell is 100px, counting border');
117-
expect(firstHeaderCell.innerWidth()).toEqual(100, "header cell is 100px, counting border");
116+
expect(firstCol.outerWidth()).toEqual(100, 'first cell is 100px, counting border');
117+
expect(firstHeaderCell.outerWidth()).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.innerWidth()).toEqual(50, 'first cell again is 50px, counting border');
132-
expect(firstHeaderCellAgain.innerWidth()).toEqual(50, 'header cell again is 50px, counting border');
131+
expect(firstColAgain.outerWidth()).toEqual(50, 'first cell again is 50px, counting border');
132+
expect(firstHeaderCellAgain.outerWidth()).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.innerWidth()).toEqual(100, 'last cell again is 100px, counting border');
138-
expect(lastHeaderCell.innerWidth()).toEqual(100, 'last header cell again is 100px, counting border');
137+
expect(lastCol.outerWidth()).toEqual(100, 'last cell again is 100px, counting border');
138+
expect(lastHeaderCell.outerWidth()).toEqual(100, 'last header cell again is 100px, counting border');
139139

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

0 commit comments

Comments
 (0)