From: Tim Otten Date: Sat, 14 Feb 2015 01:42:18 +0000 (-0800) Subject: Doc tweaks X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=3cf58cc371ca0f79f3d61883ee8bf5285abaa504;p=civicrm-core.git Doc tweaks --- diff --git a/js/angular-crm-util.js b/js/angular-crm-util.js index 515282a476..2349fcff97 100644 --- a/js/angular-crm-util.js +++ b/js/angular-crm-util.js @@ -4,8 +4,9 @@ // usage: // crmApi('Entity', 'action', {...}).then(function(apiResult){...}) - + // // Note: To mock API results in unit-tests, override crmApi.backend, e.g. + // var apiSpy = jasmine.createSpy('crmApi'); // crmApi.backend = apiSpy.and.returnValue(crmApi.val({ // is_error: 1 // })); diff --git a/js/angular-crmMailing.js b/js/angular-crmMailing.js index 3ce5edbb53..fa103049c9 100644 --- a/js/angular-crmMailing.js +++ b/js/angular-crmMailing.js @@ -294,7 +294,9 @@ }); // Controller for the "Recipients: Edit Options" dialog - // Note: Expects $scope.model to be a mailing object. + // Note: Expects $scope.model to be an object with properties: + // - "mailing" (APIv3 mailing object) + // - "fields" (list of fields) angular.module('crmMailing').controller('EditRecipOptionsDialogCtrl', function EditRecipOptionsDialogCtrl($scope) { $scope.ts = CRM.ts(null); }); diff --git a/tests/karma/unit/crmUtilSpec.js b/tests/karma/unit/crmUtilSpec.js index a661d53f39..8c0daedb4f 100644 --- a/tests/karma/unit/crmUtilSpec.js +++ b/tests/karma/unit/crmUtilSpec.js @@ -55,13 +55,13 @@ describe('crmUtil', function() { expect(fields.id.title).toBe('My entity ID'); expect(apiSpy.calls.count()).toBe(1); - // call a second time, but now the data is cached cached + // call a second time, but now the data is cached $q.when(crmMetadata.getFields('MyEntity')).then( function(fields) { expect(fields.id.title).toBe('My entity ID'); expect(apiSpy.calls.count()).toBe(1); - // third call + // call a third time using a diff interface; data is still cached! $q.when(crmMetadata.getField('MyEntity', 'id')).then( function(field) { expect(field.title).toBe('My entity ID');