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
This commit is contained in:
euzuro
2006-07-04 13:27:51 +00:00
parent 56472f15a0
commit 91f17f20ff

View File

@@ -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) {