Skip to content

Commit 9a52512

Browse files
marcelo-portugalmportuga
authored andcommitted
fix: 🐛 address linting issues and unit test failures
1 parent b5e2f82 commit 9a52512

File tree

5 files changed

+19
-30
lines changed

5 files changed

+19
-30
lines changed

packages/core/src/js/factories/GridRenderContainer.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -490,11 +490,12 @@ angular.module('ui.grid')
490490
var wholeLeftWidth = 0;
491491
var index = 0
492492
for (index; index < this.visibleColumnCache.length; index++) {
493-
if(this.visibleColumnCache[index] && this.visibleColumnCache[index].visible){
494-
//accumulate the whole width of columns on the left side, till the point of visibility is surpassed, this is our wanted index
493+
if (this.visibleColumnCache[index] && this.visibleColumnCache[index].visible) {
494+
// accumulate the whole width of columns on the left side, till the point of visibility is surpassed, this is our wanted index
495495
wholeLeftWidth += this.visibleColumnCache[index].drawnWidth;
496-
if(wholeLeftWidth >= scrollLeft)
496+
if (wholeLeftWidth >= scrollLeft) {
497497
break;
498+
}
498499
}
499500
}
500501
return index;

packages/core/src/js/services/rowSearcher.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,10 @@ module.service('rowSearcher', ['gridUtil', 'uiGridConstants', function (gridUtil
8181

8282
var term = rowSearcher.getTerm(filter);
8383

84-
if (/\*/.test(term)) {//this would check only start and end -> /^\*|\*$/
84+
if (/\*/.test(term)) {// this would check only start and end -> /^\*|\*$/
8585
var regexpFlags = (!filter.flags || !filter.flags.caseSensitive) ? 'i' : '';
8686
term = escapeRegExp(term);
87-
var reText = term.replace(/\\\*/g, '.*?');//this would check only start and end -> /^\\\*|\\\*$/g
87+
var reText = term.replace(/\\\*/g, '.*?');// this would check only start and end -> /^\\\*|\\\*$/g
8888
return new RegExp('^' + reText + '$', regexpFlags);
8989
}
9090
// Otherwise default to default condition

packages/core/test/core/factories/Grid.spec.js

+6-13
Original file line numberDiff line numberDiff line change
@@ -1181,10 +1181,9 @@ describe('Grid factory', function() {
11811181
null
11821182
);
11831183
});
1184-
it('should call adjust columns with null for a scroll percentage and the prevScrollLeft value', function() {
1184+
it('should call adjust columns with the prevScrollLeft value', function() {
11851185
expect(grid.renderContainers.body.adjustColumns).toHaveBeenCalledWith(
1186-
grid.renderContainers.body.prevScrollLeft,
1187-
null
1186+
grid.renderContainers.body.prevScrollLeft
11881187
);
11891188
});
11901189
});
@@ -1197,13 +1196,10 @@ describe('Grid factory', function() {
11971196
null
11981197
);
11991198
});
1200-
it('should call adjust columns with null for a scroll percentage and the prevScrollLeft value if prevScrollLeft is greater than 0', function() {
1199+
it('should call adjust columns with the prevScrollLeft value if prevScrollLeft is greater than 0', function() {
12011200
grid.renderContainers.body.prevScrollLeft = 20;
12021201
grid.redrawInPlace(false);
1203-
expect(grid.renderContainers.body.adjustColumns).toHaveBeenCalledWith(
1204-
grid.renderContainers.body.prevScrollLeft,
1205-
null
1206-
);
1202+
expect(grid.renderContainers.body.adjustColumns).toHaveBeenCalledWith(grid.renderContainers.body.prevScrollLeft);
12071203
});
12081204
it('should call adjust rows with null for a scroll top and the scroll percentage value if prevScrollTop is less or equal to 0', function() {
12091205
grid.renderContainers.body.prevScrollTop = 0;
@@ -1214,15 +1210,12 @@ describe('Grid factory', function() {
12141210
grid.renderContainers.body.prevScrolltopPercentage
12151211
);
12161212
});
1217-
it('should call adjust columns with null for a scroll left and the scroll percentage value if prevScrollLeft is less or equal to 0',
1213+
it('should call adjust columns with null for a scroll left if prevScrollLeft is less or equal to 0',
12181214
function() {
12191215
grid.renderContainers.body.prevScrollLeft = 0;
12201216
grid.renderContainers.body.prevScrollleftPercentage = 40;
12211217
grid.redrawInPlace(false);
1222-
expect(grid.renderContainers.body.adjustColumns).toHaveBeenCalledWith(
1223-
null,
1224-
grid.renderContainers.body.prevScrollleftPercentage
1225-
);
1218+
expect(grid.renderContainers.body.adjustColumns).toHaveBeenCalledWith(null);
12261219
});
12271220
});
12281221
});

packages/core/test/core/row-filtering.spec.js

+6-11
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
describe('rowSearcher', function() {
2-
var grid, $scope, $compile, recompile,
3-
rows, columns, rowSearcher, uiGridConstants, filter;
2+
var grid, rows, columns, rowSearcher, uiGridConstants, filter;
43

54
beforeEach(module('ui.grid'));
65

7-
beforeEach(inject(function (_$compile_, $rootScope, _rowSearcher_, Grid, GridRow, GridColumn, _uiGridConstants_) {
8-
$scope = $rootScope;
6+
beforeEach(inject(function (_rowSearcher_, Grid, GridRow, GridColumn, _uiGridConstants_) {
97
rowSearcher = _rowSearcher_;
108
uiGridConstants = _uiGridConstants_;
119

@@ -40,39 +38,38 @@ describe('rowSearcher', function() {
4038
}
4139

4240
afterEach(function () {
43-
// angular.element(grid).remove();
4441
grid = null;
4542
});
4643

4744
describe('guessCondition', function () {
4845
it('should create a RegExp when term ends with a *', function() {
4946
var filter = { term: 'blah*' };
5047

51-
var re = new RegExp(/^blah[\s\S]*?$/i);
48+
var re = new RegExp(/^blah.*?$/i);
5249

5350
expect(rowSearcher.guessCondition(filter)).toEqual(re);
5451
});
5552

5653
it('should create a RegExp when term starts with a *', function() {
5754
var filter = { term: '*blah' };
5855

59-
var re = new RegExp(/^[\s\S]*?blah$/i);
56+
var re = new RegExp(/^.*?blah$/i);
6057

6158
expect(rowSearcher.guessCondition(filter)).toEqual(re);
6259
});
6360

6461
it('should create a RegExp when term starts and ends with a *', function() {
6562
var filter = { term: '*blah*' };
6663

67-
var re = new RegExp(/^[\s\S]*?blah[\s\S]*?$/i);
64+
var re = new RegExp(/^.*?blah.*?$/i);
6865

6966
expect(rowSearcher.guessCondition(filter)).toEqual(re);
7067
});
7168

7269
it('should create a RegExp when term has a * in the middle', function() {
7370
var filter = { term: 'bl*h' };
7471

75-
var re = new RegExp(/^bl[\s\S]*?h$/i);
72+
var re = new RegExp(/^bl.*?h$/i);
7673

7774
expect(rowSearcher.guessCondition(filter)).toEqual(re);
7875
});
@@ -82,8 +79,6 @@ describe('rowSearcher', function() {
8279

8380
expect(rowSearcher.guessCondition(filter)).toEqual(uiGridConstants.filter.CONTAINS, 'CONTAINS');
8481
});
85-
86-
8782
});
8883

8984
describe('getTerm', function() {

packages/i18n/src/js/de.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -124,4 +124,4 @@
124124
return $delegate;
125125
}]);
126126
}]);
127-
})();
127+
})();

0 commit comments

Comments
 (0)