From 91f17f20ff1c58c85d951b503b302288c41569be Mon Sep 17 00:00:00 2001 From: euzuro Date: Tue, 4 Jul 2006 13:27:51 +0000 Subject: [PATCH] added some more just-in-case tests to test the unregister() function git-svn-id: http://svn.openlayers.org/trunk/openlayers@874 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf --- tests/test_Events.html | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/tests/test_Events.html b/tests/test_Events.html index cc3d0f4f33..862712c4f3 100644 --- a/tests/test_Events.html +++ b/tests/test_Events.html @@ -41,7 +41,7 @@ function test_02_Events_register_unregister(t) { - t.plan( 15 ); + t.plan( 18 ); var mapDiv = $('map'); var obj = {result: 0}; @@ -105,8 +105,21 @@ } t.ok( (listenerList.length == 1) && !found, "unregister correctly removes callback when no obj specified" ); + var func4 = function () { this.result = "chicken"; } + events.unregister("doThingA", obj, func4); + t.ok( (listenerList.length == 1), "unregister does not bomb if you try to remove an unregistered callback" ); + + var obj2 = { chicken: 151 }; + events.unregister("doThingA", obj2, func2); + t.ok( (listenerList.length == 1), "unregister does not bomb or accidntally remove if you try to remove a valid callback on a valid event type, but with the wrong context object" ); + + events.unregister("doThingA", obj, null); + t.ok( (listenerList.length == 1), "unregister does not bomb if you try to remove a null callback" ); + events.unregister("chicken", null, func3); t.ok( events.listeners["chicken"] == null, "unregistering an event that is not enabled does not wierdly enable it -- or cause a script error") + + } function test_03_Events_remove(t) {