[Pkg-javascript-commits] [backbone] 79/281: unit test for ignore values when unsetting

Jonas Smedegaard js at moszumanska.debian.org
Sat May 3 17:01:58 UTC 2014


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

js pushed a commit to tag 0.9.0
in repository backbone.

commit 66d209d4f9e22fae3b4d835fb6de6432cb58c9ae
Author: Brad Dunbar <dunbarb2 at gmail.com>
Date:   Thu Nov 10 10:10:17 2011 -0500

    unit test for ignore values when unsetting
---
 test/model.js | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/test/model.js b/test/model.js
index 8b47d57..5778097 100644
--- a/test/model.js
+++ b/test/model.js
@@ -140,19 +140,24 @@ $(document).ready(function() {
   });
 
   test("Model: set and unset", function() {
+    expect(8);
     attrs = {id: 'id', foo: 1, bar: 2, baz: 3};
     a = new Backbone.Model(attrs);
     var changeCount = 0;
     a.bind("change:foo", function() { changeCount += 1; });
     a.set({'foo': 2});
-    ok(a.get('foo')== 2, "Foo should have changed.");
+    ok(a.get('foo') == 2, "Foo should have changed.");
     ok(changeCount == 1, "Change count should have incremented.");
     a.set({'foo': 2}); // set with value that is not new shouldn't fire change event
-    ok(a.get('foo')== 2, "Foo should NOT have changed, still 2");
+    ok(a.get('foo') == 2, "Foo should NOT have changed, still 2");
     ok(changeCount == 1, "Change count should NOT have incremented.");
 
-    a.unset('foo');
-    ok(a.get('foo')== null, "Foo should have changed");
+    a.validate = function(attrs) {
+      ok(attrs.foo === void 0, 'ignore values when unsetting');
+    };
+    a.unset({foo: 1});
+    ok(a.get('foo') == null, "Foo should have changed");
+    delete a.validate;
     ok(changeCount == 2, "Change count should have incremented for unset.");
 
     a.unset('id');

-- 
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