Cleanup
authorTim Otten <totten@civicrm.org>
Fri, 19 Jul 2013 02:09:54 +0000 (19:09 -0700)
committerTim Otten <totten@civicrm.org>
Fri, 19 Jul 2013 02:10:06 +0000 (19:10 -0700)
js/crm.backbone.js
tests/qunit/crm-backbone/test.js

index 96b70c01242909b87f2a0bda64193c5522b9148f..e84089476cd93790e140ea0debaf7eeafb345c71 100644 (file)
@@ -11,6 +11,7 @@
    * @param method
    * @param model
    * @param options
+   * @see tests/qunit/crm-backbone
    */
   CRM.Backbone.sync = function(method, model, options) {
     var isCollection = _.isArray(model.models);
@@ -95,6 +96,7 @@
    *
    * @param Class ModelClass
    * @param string crmEntityName APIv3 entity name, such as "Contact" or "CustomField"
+   * @see tests/qunit/crm-backbone
    */
   CRM.Backbone.extendModel = function(ModelClass, crmEntityName) {
     // Defaults - if specified in ModelClass, preserve
    * @endcode
    *
    * @param Class CollectionClass
+   * @see tests/qunit/crm-backbone
    */
   CRM.Backbone.extendCollection = function(CollectionClass) {
     var origInit = CollectionClass.prototype.initialize;
     toStrictJSON: function() {
       var schema = this.schema;
       var result = this.toJSON();
-      _.each(result, function(value, key){
-        if (! schema[key]) {
+      _.each(result, function(value, key) {
+        if (!schema[key]) {
           delete result[key];
         }
       });
       this.rels = this.rels || {};
       if (this.rels[key] != value) {
         this.rels[key] = value;
-        this.trigger("rel:"+key, value);
+        this.trigger("rel:" + key, value);
       }
     },
     getRel: function(key) {
     },
     _copyToChildren: function() {
       var collection = this;
-      collection.each(function(model){
+      collection.each(function(model) {
         collection._copyToChild(model);
       });
     },
     _copyToChild: function(model) {
-      _.each(this.rels, function(relValue, relKey){
+      _.each(this.rels, function(relValue, relKey) {
         model.setRel(relKey, relValue, {silent: true});
       });
     },
       this.rels = this.rels || {};
       if (this.rels[key] != value) {
         this.rels[key] = value;
-        this.trigger("rel:"+key, value);
+        this.trigger("rel:" + key, value);
       }
     },
     getRel: function(key) {
index 659d7ceaeb86bf938e6ba27b604be744a2e232e8..ed870c23d6f25b0fba90a3c81f377959eba98c9d 100644 (file)
@@ -72,7 +72,7 @@ asyncTest("create/read/delete/read (ok)", function() {
   c1.save({}, {
     error: onUnexpectedError,
     success: function() {
-      equal(c1.get("first_name"), "George"+TOKEN, "save() should return new first name");
+      equal(c1.get("first_name"), "George" + TOKEN, "save() should return new first name");
 
       // Fetch the newly created contact
       var c2 = new ContactModel({id: c1.get('id')});