Skip to content

Commit

Permalink
fix(uiGridHeaderCell): Change test measure method
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
c0bra committed Feb 3, 2015
1 parent 1f786b9 commit 7774d30
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,7 @@ module.exports = function(grunt) {

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

// Default task.
Expand Down
12 changes: 6 additions & 6 deletions test/unit/core/directives/uiGridCell.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.innerWidth()).toEqual(100, 'first cell is 100px, counting border');
expect(firstHeaderCell.innerWidth()).toEqual(100, "header cell is 100px, counting border");
expect(firstCol.outerWidth()).toEqual(100, 'first cell is 100px, counting border');
expect(firstHeaderCell.outerWidth()).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.innerWidth()).toEqual(50, 'first cell again is 50px, counting border');
expect(firstHeaderCellAgain.innerWidth()).toEqual(50, 'header cell again is 50px, counting border');
expect(firstColAgain.outerWidth()).toEqual(50, 'first cell again is 50px, counting border');
expect(firstHeaderCellAgain.outerWidth()).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.innerWidth()).toEqual(100, 'last cell again is 100px, counting border');
expect(lastHeaderCell.innerWidth()).toEqual(100, 'last header cell again is 100px, counting border');
expect(lastCol.outerWidth()).toEqual(100, 'last cell again is 100px, counting border');
expect(lastHeaderCell.outerWidth()).toEqual(100, 'last header cell again is 100px, counting border');

angular.element(gridElm).remove();
}));
Expand Down

0 comments on commit 7774d30

Please sign in to comment.