[Pkg-javascript-commits] [backbone] 01/23: fix documentation and tests for negative ids
Jonas Smedegaard
js at moszumanska.debian.org
Sat May 3 17:00:43 UTC 2014
This is an automated email from the git hooks/post-receive script.
js pushed a commit to tag 0.5.1
in repository backbone.
commit 13acb8a8229e2d567699d8dd154741cc822345c5
Author: Matt Smith <matthewgarysmith at gmail.com>
Date: Thu Mar 3 17:06:16 2011 -0500
fix documentation and tests for negative ids
The documentation said that a model was considered new if it had a negative id.
The test had the right message, but failed to instantiate the model the for the second assertion, and the assertion was inverted.
---
backbone.js | 3 +--
test/model.js | 3 ++-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/backbone.js b/backbone.js
index 47e85ae..c5eb7e6 100644
--- a/backbone.js
+++ b/backbone.js
@@ -321,8 +321,7 @@
return new this.constructor(this);
},
- // A model is new if it has never been saved to the server, and has a negative
- // ID.
+ // A model is new if it does not have an ID.
isNew : function() {
return !this.id;
},
diff --git a/test/model.js b/test/model.js
index 7b4e9dd..6598e0e 100644
--- a/test/model.js
+++ b/test/model.js
@@ -96,7 +96,8 @@ $(document).ready(function() {
a = new Backbone.Model(attrs);
ok(a.isNew(), "it should be new");
attrs = { 'foo': 1, 'bar': 2, 'baz': 3, 'id': -5 };
- ok(a.isNew(), "any defined ID is legal, negative or positive");
+ a = new Backbone.Model(attrs);
+ ok(!a.isNew(), "any defined ID is legal, negative or positive");
});
test("Model: get", function() {
--
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