Skip to content

Commit eb6e76d

Browse files
committed
jshint tests refactoring and improvements
1 parent 1bd7bf6 commit eb6e76d

File tree

7 files changed

+268
-225
lines changed

7 files changed

+268
-225
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"dev-build": "webpack --config webpack/config.js",
2525
"dev-server": "webpack-dev-server --config webpack/config.js",
2626
"dev-test": "karma start test/config/karma.conf.js",
27-
"hint-tests": "jshint test/*Spec.js",
27+
"hint-tests": "jshint --verbose test",
2828
"start": "npm run dev-server",
2929
"test": "npm run hint-tests && npm run dev-test",
3030
"build": "npm run prod-build && npm run prod-test"

test/.jshintrc

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,32 @@
11
{
2-
"node": true,
2+
"bitwise": true,
3+
"curly": true,
4+
"browser": true,
5+
"eqeqeq": true,
36
"expr": true,
4-
"sub": true,
57
"esversion": 6,
8+
"forin": true,
9+
"freeze": true,
10+
"futurehostile": true,
11+
"iterator": true,
12+
"jasmine": true,
13+
"jquery": true,
14+
"latedef": true,
15+
"noarg": true,
16+
"nocomma": true,
17+
"node": true,
18+
"nonbsp": true,
19+
"nonew": true,
20+
"smarttabs": true,
21+
"strict": true,
22+
"sub": true,
23+
"trailing": true,
24+
"undef": true,
25+
"unused": true,
626
"globals": {
7-
"angular2": false,
27+
"angular": false,
828
"inject": false,
9-
"jQuery": false,
10-
"jasmine": false,
11-
"afterEach": false,
12-
"beforeEach": false,
13-
"ddescribe": false,
14-
"describe": false,
15-
"expect": false,
16-
"iit": false,
17-
"it": false,
18-
"spyOn": false,
19-
"xdescribe": false,
20-
"xit": false
29+
"runTest": false,
30+
"runGridTest": false
2131
}
2232
}

test/AdapterTestsSpec.js

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ describe('uiScroll', function () {
3636
function (viewport, scope) {
3737

3838
scope.adapter.applyUpdates(
39-
function (item, scope) {
39+
function(item, scope){
4040
return [item + ' *' + scope.$index];
4141
}
4242
);
@@ -67,8 +67,9 @@ describe('uiScroll', function () {
6767

6868
scope.adapter.applyUpdates(
6969
function (item, scope) {
70-
if (item === 'one')
70+
if (item === 'one') {
7171
return [item + ' *' + scope.$index];
72+
}
7273
}
7374
);
7475

@@ -99,8 +100,9 @@ describe('uiScroll', function () {
99100

100101
scope.adapter.applyUpdates(
101102
function (item, scope) {
102-
if (item === 'two')
103+
if (item === 'two') {
103104
return [item + ' *' + scope.$index];
105+
}
104106
}
105107
);
106108

@@ -131,8 +133,9 @@ describe('uiScroll', function () {
131133

132134
scope.adapter.applyUpdates(
133135
function (item, scope) {
134-
if (item === 'three')
136+
if (item === 'three') {
135137
return [item + ' *' + scope.$index];
138+
}
136139
}
137140
);
138141

@@ -163,8 +166,9 @@ describe('uiScroll', function () {
163166

164167
scope.adapter.applyUpdates(
165168
function (item) {
166-
if (item === 'one')
169+
if (item === 'one') {
167170
return [];
171+
}
168172
}
169173
);
170174

@@ -191,8 +195,9 @@ describe('uiScroll', function () {
191195

192196
scope.adapter.applyUpdates(
193197
function (item) {
194-
if (item === 'two')
198+
if (item === 'two') {
195199
return [];
200+
}
196201
}
197202
);
198203

@@ -219,8 +224,9 @@ describe('uiScroll', function () {
219224

220225
scope.adapter.applyUpdates(
221226
function (item) {
222-
if (item === 'three')
227+
if (item === 'three') {
223228
return [];
229+
}
224230
}
225231
);
226232

@@ -247,8 +253,9 @@ describe('uiScroll', function () {
247253

248254
scope.adapter.applyUpdates(
249255
function (item) {
250-
if (item === 'one')
256+
if (item === 'one') {
251257
return ['before one', item];
258+
}
252259
}
253260
);
254261

@@ -284,8 +291,9 @@ describe('uiScroll', function () {
284291

285292
scope.adapter.applyUpdates(
286293
function (item) {
287-
if (item.text === 'one')
294+
if (item.text === 'one') {
288295
return [item, {text: 'after one'}];
296+
}
289297
}
290298
);
291299

@@ -320,8 +328,9 @@ describe('uiScroll', function () {
320328

321329
scope.adapter.applyUpdates(
322330
function (item) {
323-
if (item === 'two')
331+
if (item === 'two') {
324332
return ['before two', item];
333+
}
325334
}
326335
);
327336

@@ -356,8 +365,9 @@ describe('uiScroll', function () {
356365

357366
scope.adapter.applyUpdates(
358367
function (item) {
359-
if (item === 'three')
368+
if (item === 'three') {
360369
return [item, 'after three'];
370+
}
361371
}
362372
);
363373

@@ -798,7 +808,7 @@ describe('uiScroll', function () {
798808

799809
scope.adapter.applyUpdates(
800810
function (item, scope) {
801-
if (scope.$index == 1) {
811+
if (scope.$index === 1) {
802812
item.text += ' *' + scope.$index;
803813
return [
804814
{text: item.text + ' before 1'},
@@ -855,7 +865,7 @@ describe('uiScroll', function () {
855865

856866
scope.adapter.applyUpdates(
857867
function (item, scope) {
858-
if (scope.$index == 2) {
868+
if (scope.$index === 2) {
859869
item.text += ' *' + scope.$index;
860870
return [
861871
{text: item.text + ' before 1'},

test/config/karma.conf.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const chrome = process.platform === 'linux' ? 'Chromium' : 'Chrome';
22
const firefox = 'Firefox';
3-
const ie = 'IE';
3+
//const ie = 'IE';
44

55
const ENV = (process.env.npm_lifecycle_event.indexOf('dev') === 0) ? 'development' : 'production';
66

@@ -12,6 +12,8 @@ const webpackSettings = ENV === 'development' ? {
1212
} : {};
1313

1414
module.exports = function (config) {
15+
'use strict';
16+
1517
config.set(Object.assign({
1618

1719
basePath: '',

0 commit comments

Comments
 (0)