For controls with multiple handlers, we now tack them on to a handlers object. The base destroy takes care of the handlers. r=crschmidt,uz/2 (closes #1338)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@6106 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -14,7 +14,7 @@
|
||||
"new OpenLayers.Control.DragFeature returns an instance");
|
||||
t.eq(control.layer, "bar",
|
||||
"constructor sets layer correctly");
|
||||
t.eq(control.featureHandler.geometryTypes, "foo",
|
||||
t.eq(control.handlers.feature.geometryTypes, "foo",
|
||||
"constructor sets options correctly on feature handler");
|
||||
}
|
||||
|
||||
@@ -24,14 +24,15 @@
|
||||
var layer = new OpenLayers.Layer.Vector();
|
||||
map.addLayer(layer);
|
||||
var control = new OpenLayers.Control.DragFeature(layer);
|
||||
control.dragHandler.destroy = function() {
|
||||
control.handlers.drag.destroy = function() {
|
||||
t.ok(true,
|
||||
"control.destroy calls destroy on drag handler");
|
||||
}
|
||||
control.featureHandler.destroy = function() {
|
||||
control.handlers.feature.destroy = function() {
|
||||
t.ok(true,
|
||||
"control.destroy calls destroy on feature handler");
|
||||
}
|
||||
|
||||
control.destroy();
|
||||
|
||||
}
|
||||
@@ -43,10 +44,10 @@
|
||||
map.addLayer(layer);
|
||||
var control = new OpenLayers.Control.DragFeature(layer);
|
||||
map.addControl(control);
|
||||
t.ok(!control.featureHandler.active,
|
||||
t.ok(!control.handlers.feature.active,
|
||||
"feature handler is not active prior to activating control");
|
||||
control.activate();
|
||||
t.ok(control.featureHandler.active,
|
||||
t.ok(control.handlers.feature.active,
|
||||
"feature handler is active after activating control");
|
||||
}
|
||||
|
||||
@@ -58,11 +59,11 @@
|
||||
var control = new OpenLayers.Control.DragFeature(layer);
|
||||
map.addControl(control);
|
||||
|
||||
control.dragHandler.deactivate = function() {
|
||||
control.handlers.drag.deactivate = function() {
|
||||
t.ok(true,
|
||||
"control.deactivate calls deactivate on drag handler");
|
||||
}
|
||||
control.featureHandler.deactivate = function() {
|
||||
control.handlers.feature.deactivate = function() {
|
||||
t.ok(true,
|
||||
"control.deactivate calls deactivate on feature handler");
|
||||
}
|
||||
@@ -78,7 +79,7 @@
|
||||
map.addControl(control);
|
||||
|
||||
control.activate();
|
||||
t.ok(!control.dragHandler.active,
|
||||
t.ok(!control.handlers.drag.active,
|
||||
"drag handler is not active before over a feature");
|
||||
|
||||
// simulate a mouseover on a feature
|
||||
@@ -89,7 +90,7 @@
|
||||
|
||||
t.eq(control.feature, "foo",
|
||||
"control gets the proper feature from the feature handler");
|
||||
t.ok(control.dragHandler.active,
|
||||
t.ok(control.handlers.drag.active,
|
||||
"drag handler activated when over a feature");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user