Permalink
Browse files

Merge pull request #2050 from gsamokovarov/listen-to-cleans-itself

Add listenTo yourself and cleaning with stopListening test
  • Loading branch information...
2 parents 4be2323 + baac550 commit 3f300c43a4dd76dda5202fe5fdeba2dd17b23f4e @jashkenas committed Dec 30, 2012
Showing with 8 additions and 0 deletions.
  1. +8 −0 test/events.js
View
@@ -92,6 +92,14 @@ $(document).ready(function() {
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() {
var a, b, obj = { counter: 0 };
_.extend(obj, Backbone.Events);

0 comments on commit 3f300c4

Please sign in to comment.