Skip to content

Commit

Permalink
Merge pull request #2050 from gsamokovarov/listen-to-cleans-itself
Browse files Browse the repository at this point in the history
Add listenTo yourself and cleaning with stopListening test
  • Loading branch information
jashkenas committed Dec 30, 2012
2 parents 4be2323 + baac550 commit 3f300c4
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions test/events.js
Expand Up @@ -92,6 +92,14 @@ $(document).ready(function() {
e.trigger("foo"); e.trigger("foo");
}); });


test("listenTo yourself cleans yourself up with stopListening", 1, function(){
var e = _.extend({}, Backbone.Events);
e.listenTo(e, "foo", function(){ ok(true); });
e.trigger("foo");
e.stopListening();
e.trigger("foo");
});

test("trigger all for each event", 3, function() { test("trigger all for each event", 3, function() {
var a, b, obj = { counter: 0 }; var a, b, obj = { counter: 0 };
_.extend(obj, Backbone.Events); _.extend(obj, Backbone.Events);
Expand Down

0 comments on commit 3f300c4

Please sign in to comment.