From 3cf58cc371ca0f79f3d61883ee8bf5285abaa504 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Fri, 13 Feb 2015 17:42:18 -0800 Subject: [PATCH] Doc tweaks --- js/angular-crm-util.js | 3 ++- js/angular-crmMailing.js | 4 +++- tests/karma/unit/crmUtilSpec.js | 4 ++-- 3 files changed, 7 insertions(+), 4 deletions(-) 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'); -- 2.25.1