From: Tim Otten Date: Tue, 27 Jan 2015 05:46:43 +0000 (-0800) Subject: INFRA-132 - Add .jshintrc. Cleanup tests/karama/unit. X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=da8f0cf5b79bdf01e67fb96e5aa9120594ac5fc0;p=civicrm-core.git INFRA-132 - Add .jshintrc. Cleanup tests/karama/unit. --- diff --git a/.jshintrc b/.jshintrc new file mode 100644 index 0000000000..01ed9200ed --- /dev/null +++ b/.jshintrc @@ -0,0 +1,12 @@ +{ + "indent": 2, + "jasmine": true, + "predef": [ + "angular", + "inject", + "module", + + "CRM" + ], + "-W097": true +} \ No newline at end of file diff --git a/tests/karma/unit/crmAutosaveSpec.js b/tests/karma/unit/crmAutosaveSpec.js index 7633e84ef7..fc5926aefe 100644 --- a/tests/karma/unit/crmAutosaveSpec.js +++ b/tests/karma/unit/crmAutosaveSpec.js @@ -1,14 +1,6 @@ -describe('crmAutosave', function() { +'use strict'; - function using(name, values, func) { - for (var i = 0, count = values.length; i < count; i++) { - if (Object.prototype.toString.call(values[i]) !== '[object Array]') { - values[i] = [values[i]]; - } - func.apply(this, values[i]); - jasmine.currentEnv_.currentSpec.description += ' (with "' + name + '" using ' + values[i].join(', ') + ')'; - } - } +describe('crmAutosave', function() { beforeEach(function() { module('crmUtil'); diff --git a/tests/karma/unit/crmCaseTypeSpec.js b/tests/karma/unit/crmCaseTypeSpec.js index c4917626ab..3b5d630723 100644 --- a/tests/karma/unit/crmCaseTypeSpec.js +++ b/tests/karma/unit/crmCaseTypeSpec.js @@ -167,11 +167,11 @@ describe('crmCaseType', function() { })); it('should load activity statuses', function() { - expect(scope.activityStatuses).toEqualData([apiCalls['actStatuses']['values']['272'], apiCalls['actStatuses']['values']['273']]); + expect(scope.activityStatuses).toEqualData([apiCalls.actStatuses.values['272'], apiCalls.actStatuses.values['273']]); }); it('should load activity types', function() { - expect(scope.activityTypes).toEqualData(apiCalls['actTypes']['values']); + expect(scope.activityTypes).toEqualData(apiCalls.actTypes.values); }); it('addActivitySet should add an activitySet to the case type', function() { diff --git a/tests/karma/unit/crmMailingSpec.js b/tests/karma/unit/crmMailingSpec.js index db795bfaeb..89e966eee2 100644 --- a/tests/karma/unit/crmMailingSpec.js +++ b/tests/karma/unit/crmMailingSpec.js @@ -14,7 +14,7 @@ describe('crmMailing', function() { beforeEach(function() { navigator = jasmine.createSpyObj('crmNavigator', ['redirect']); module(function ($provide) { - $provide.value('crmNavigator', navigator) + $provide.value('crmNavigator', navigator); }); inject(['crmLegacy', function(crmLegacy) { crmLegacy.url({back: '/*path*?*query*', front: '/*path*?*query*'});