Fix error in event.js which prevented attaching more than one responder for an event name/element combination. [#651 state:resolved] (Rob Lineweaver)

This commit is contained in:
Andrew Dupont 2009-05-02 13:48:41 -05:00
parent 005f066f1a
commit 6f6b73cc75
2 changed files with 20 additions and 0 deletions

View File

@ -1,3 +1,5 @@
* Fix error in event.js which prevented attaching more than one responder for an event name/element combination. [#651 state:resolved] (Rob Lineweaver)
* Do not sniff when testing for IE's proprietary mouseenter/mouseleave events support. Use more robust inference instead. (kangax)
* Use `Prototype.emptyFunction` consistently throughout unit tests. [#253 state:resolved] (Michael M Slusarz, John David Dalton, kangax)

View File

@ -109,6 +109,24 @@ new Test.Unit.Runner({
span.fire("test:somethingElseHappened");
this.assertEqual(2, count);
},
testMultipleEventHandlersCanBeAddedAndRemovedFromAnElement: function() {
var span = $("span"), count1 = 0, count2 = 0;
var observer1 = function() { count1++ };
var observer2 = function() { count2++ };
span.observe("test:somethingHappened", observer1);
span.observe("test:somethingHappened", observer2);
span.fire("test:somethingHappened");
this.assertEqual(1, count1);
this.assertEqual(1, count2);
span.stopObserving("test:somethingHappened", observer1);
span.stopObserving("test:somethingHappened", observer2);
span.fire("test:somethingHappened");
this.assertEqual(1, count1);
this.assertEqual(1, count2);
},
testStopObservingWithoutArguments: function() {
var span = $("span"), count = 0, observer = function() { count++ };