diff --git a/test/bindable.js b/test/bindable.js index 465a6767..5f8b79af 100644 --- a/test/bindable.js +++ b/test/bindable.js @@ -3,40 +3,40 @@ $(document).ready(function() { module("Backbone bindable"); test("bindable: bind and trigger", function() { - var obj = { counter: 0 } + var obj = { counter: 0 }; _.extend(obj,Backbone.Bindable); - obj.bind('foo',function() { obj.counter += 1; }); - obj.trigger('foo'); + obj.bind('event', function() { obj.counter += 1; }); + obj.trigger('event'); 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.'); + obj.trigger('event'); + obj.trigger('event'); + obj.trigger('event'); + obj.trigger('event'); + equals(obj.counter, 5, 'counter should be incremented five times.'); }); - + test("bindable: bind, then unbind all functions", function() { - var obj = { counter: 0 } + var obj = { counter: 0 }; _.extend(obj,Backbone.Bindable); - var callback = function() { obj.counter += 1; } - obj.bind('foo', callback); - obj.trigger('foo'); - obj.unbind('foo'); - obj.trigger('foo'); - equals(obj.counter,1,'counter should have only been incremented once.') + var callback = function() { obj.counter += 1; }; + obj.bind('event', callback); + obj.trigger('event'); + obj.unbind('event'); + obj.trigger('event'); + equals(obj.counter, 1, 'counter should have only been incremented once.'); }); test("bindable: bind two callbacks, unbind only one", function() { - var obj = { counterA: 0, counterB: 0 } + var obj = { counterA: 0, counterB: 0 }; _.extend(obj,Backbone.Bindable); var callback = function() { obj.counterA += 1; }; - obj.bind('foo', callback); - obj.bind('foo', function() { obj.counterB += 1 }); - obj.trigger('foo'); - obj.unbind('foo', callback); - obj.trigger('foo'); - equals(obj.counterA,1,'counterA should have only been incremented once.') - equals(obj.counterB,2,'counterB should have been incremented twice.') + obj.bind('event', callback); + obj.bind('event', function() { obj.counterB += 1; }); + obj.trigger('event'); + obj.unbind('event', callback); + obj.trigger('event'); + equals(obj.counterA, 1, 'counterA should have only been incremented once.'); + equals(obj.counterB, 2, 'counterB should have been incremented twice.'); }); }); \ No newline at end of file