Doc tweaks
authorTim Otten <totten@civicrm.org>
Sat, 14 Feb 2015 01:42:18 +0000 (17:42 -0800)
committerTim Otten <totten@civicrm.org>
Sat, 14 Feb 2015 03:53:48 +0000 (19:53 -0800)
js/angular-crm-util.js
js/angular-crmMailing.js
tests/karma/unit/crmUtilSpec.js

index 515282a4766c52dc3fecd3e53166c31bde821d74..2349fcff97c472730b277d5b6fe75d44ca104b1f 100644 (file)
@@ -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
   //   }));
index 3ce5edbb5397bc78a9e8d04abdb96bdcbbf25317..fa103049c9bff72666dadbb6732c8af55198c64b 100644 (file)
   });
 
   // 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);
   });
index a661d53f39227a01278befb3824794c3b380546c..8c0daedb4fdd7830ab9cbc676a3dfd606fdc4bd1 100644 (file)
@@ -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');