[Pkg-javascript-commits] [backbone] 91/173: Enforce camelCase ESLint rule in tests

Jonas Smedegaard dr at jones.dk
Wed Aug 31 07:44:07 UTC 2016


This is an automated email from the git hooks/post-receive script.

js pushed a commit to branch master
in repository backbone.

commit 9eb9124ec98a57bbf7866ab34dbe6f62a10955cc
Author: Jordan Eldredge <jordan at jordaneldredge.com>
Date:   Wed Dec 16 08:17:53 2015 -0800

    Enforce camelCase ESLint rule in tests
---
 test/.eslintrc     |  1 -
 test/collection.js |  6 +++---
 test/model.js      | 14 +++++++-------
 3 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/test/.eslintrc b/test/.eslintrc
index d58edcc..3a66727 100644
--- a/test/.eslintrc
+++ b/test/.eslintrc
@@ -9,7 +9,6 @@
     "$": true
   },
   "rules": {
-    "camelCase": 0,
     "no-throw-literal": 0,
     "no-undefined": 0,
     "quote-props": 0
diff --git a/test/collection.js b/test/collection.js
index 17acf72..4f4dcf9 100644
--- a/test/collection.js
+++ b/test/collection.js
@@ -789,14 +789,14 @@
     assert.expect(3);
     var Model = Backbone.Model.extend({
       initialize: function(attrs, options) {
-        this.model_parameter = options.model_parameter;
+        this.modelParameter = options.modelParameter;
       }
     });
     var col = new (Backbone.Collection.extend({model: Model}))();
-    col.reset([{astring: 'green', anumber: 1}, {astring: 'blue', anumber: 2}], {model_parameter: 'model parameter'});
+    col.reset([{astring: 'green', anumber: 1}, {astring: 'blue', anumber: 2}], {modelParameter: 'model parameter'});
     assert.equal(col.length, 2);
     col.each(function(model) {
-      assert.equal(model.model_parameter, 'model parameter');
+      assert.equal(model.modelParameter, 'model parameter');
     });
   });
 
diff --git a/test/model.js b/test/model.js
index c508e6d..45db361 100644
--- a/test/model.js
+++ b/test/model.js
@@ -61,13 +61,13 @@
     assert.expect(2);
     var Model = Backbone.Model.extend({
       defaults: {
-        first_name: 'Unknown',
-        last_name: 'Unknown'
+        firstName: 'Unknown',
+        lastName: 'Unknown'
       }
     });
-    var model = new Model({'first_name': 'John'});
-    assert.equal(model.get('first_name'), 'John');
-    assert.equal(model.get('last_name'), 'Unknown');
+    var model = new Model({'firstName': 'John'});
+    assert.equal(model.get('firstName'), 'John');
+    assert.equal(model.get('lastName'), 'Unknown');
   });
 
   QUnit.test('parse can return null', function(assert) {
@@ -108,11 +108,11 @@
     assert.expect(2);
     var Model = Backbone.Model.extend({
       urlRoot: function() {
-        return '/nested/' + this.get('parent_id') + '/collection';
+        return '/nested/' + this.get('parentId') + '/collection';
       }
     });
 
-    var model = new Model({parent_id: 1});
+    var model = new Model({parentId: 1});
     assert.equal(model.url(), '/nested/1/collection');
     model.set({id: 2});
     assert.equal(model.url(), '/nested/1/collection/2');

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/backbone.git



More information about the Pkg-javascript-commits mailing list