[Pkg-javascript-commits] [backbone] 09/101: some more tests

Jonas Smedegaard js at moszumanska.debian.org
Sat May 3 16:58:24 UTC 2014


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

js pushed a commit to tag 0.1.0
in repository backbone.

commit d66f2ed161f8abd3d2c77e48c1bff08ffdb9df2f
Author: Joe Germuska <joe at germuska.com>
Date:   Sat Oct 2 15:58:26 2010 -0500

    some more tests
---
 test/bindable.js   | 21 +++++++--------------
 test/collection.js |  0
 test/model.js      | 14 ++++++++++++++
 test/test.html     |  3 +++
 test/view.js       |  0
 5 files changed, 24 insertions(+), 14 deletions(-)

diff --git a/test/bindable.js b/test/bindable.js
index 4228069..465a676 100644
--- a/test/bindable.js
+++ b/test/bindable.js
@@ -1,28 +1,21 @@
 $(document).ready(function() {
 
-  module("Bindable");
+  module("Backbone bindable");
 
-  test("bind and trigger", function() {
-      var obj = { counter: 0 }
-      _.extend(obj,Backbone.Bindable);
-      obj.bind('foo',function() { obj.counter += 1; });
-      obj.trigger('foo');
-    equals(obj.counter,1,'counter should be incremented.');
-  });
-  
-  test("repeated trigger", function()         {
+    test("bindable: bind and trigger", function() {
         var obj = { counter: 0 }
         _.extend(obj,Backbone.Bindable);
         obj.bind('foo',function() { obj.counter += 1; });
         obj.trigger('foo');
+        equals(obj.counter,1,'counter should be incremented.');
         obj.trigger('foo');
         obj.trigger('foo');
         obj.trigger('foo');
         obj.trigger('foo');
         equals(obj.counter,5,'counter should be incremented five times.');
     });
-
-    test("bind, then unbind all functions", function() {
+  
+    test("bindable: bind, then unbind all functions", function() {
         var obj = { counter: 0 }
         _.extend(obj,Backbone.Bindable);
         var callback = function() { obj.counter += 1; }
@@ -32,8 +25,8 @@ $(document).ready(function() {
         obj.trigger('foo');
         equals(obj.counter,1,'counter should have only been incremented once.')
     });
-    
-    test("bind two callbacks, unbind only one", function() {
+
+    test("bindable: bind two callbacks, unbind only one", function() {
         var obj = { counterA: 0, counterB: 0 }
         _.extend(obj,Backbone.Bindable);
         var callback = function() { obj.counterA += 1; };
diff --git a/test/collection.js b/test/collection.js
new file mode 100644
index 0000000..e69de29
diff --git a/test/model.js b/test/model.js
new file mode 100644
index 0000000..7075a51
--- /dev/null
+++ b/test/model.js
@@ -0,0 +1,14 @@
+$(document).ready(function() {
+
+  module("Backbone model");
+
+  test("model: clone", function() {
+      attrs = { 'foo': 1, 'bar': 2, 'baz': 3};
+      a = new Backbone.Model(attrs);
+      b = a.clone();
+      equals(b.foo,a.foo,"Foo should be the same on the clone.");
+      equals(b.bar,a.bar,"Bar should be the same on the clone.");
+      equals(b.baz,a.baz,"Baz should be the same on the clone.");
+  });
+
+});
\ No newline at end of file
diff --git a/test/test.html b/test/test.html
index 11ff3d3..4ecd386 100644
--- a/test/test.html
+++ b/test/test.html
@@ -9,6 +9,9 @@
   <script type="text/javascript" src="../backbone.js"></script>
 
   <script type="text/javascript" src="bindable.js"></script>
+  <script type="text/javascript" src="model.js"></script>
+  <script type="text/javascript" src="collection.js"></script>
+  <script type="text/javascript" src="view.js"></script>
 </head>
 <body>
   <h1 id="qunit-header">Backbone Test Suite</h1>
diff --git a/test/view.js b/test/view.js
new file mode 100644
index 0000000..e69de29

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