diff --git a/test/bindable.js b/test/bindable.js index 4228069f..465a6767 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 00000000..e69de29b diff --git a/test/model.js b/test/model.js new file mode 100644 index 00000000..7075a51a --- /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 11ff3d32..4ecd3863 100644 --- a/test/test.html +++ b/test/test.html @@ -9,6 +9,9 @@ + + +