From 6f6b73cc75b038a66ed14e1e793a9e86173439f5 Mon Sep 17 00:00:00 2001 From: Andrew Dupont Date: Sat, 2 May 2009 13:48:41 -0500 Subject: [PATCH] Fix error in event.js which prevented attaching more than one responder for an event name/element combination. [#651 state:resolved] (Rob Lineweaver) --- CHANGELOG | 2 ++ test/unit/event_test.js | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index dc1c89c..dba3771 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -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) diff --git a/test/unit/event_test.js b/test/unit/event_test.js index c399b88..fc6df25 100644 --- a/test/unit/event_test.js +++ b/test/unit/event_test.js @@ -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++ };