From 7774d30e6085a0f98850a94880961f0511ddce50 Mon Sep 17 00:00:00 2001 From: Brian Hann Date: Tue, 3 Feb 2015 10:16:28 -0600 Subject: [PATCH] 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. --- Gruntfile.js | 2 +- test/unit/core/directives/uiGridCell.spec.js | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 2cab05054e..4ca9edf862 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -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. diff --git a/test/unit/core/directives/uiGridCell.spec.js b/test/unit/core/directives/uiGridCell.spec.js index a97c9cafd1..c7ed7da116 100644 --- a/test/unit/core/directives/uiGridCell.spec.js +++ b/test/unit/core/directives/uiGridCell.spec.js @@ -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 }]; @@ -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(); }));