From a5ea8d7fcf58bf2916c7c0f78ff01f5be37835ff Mon Sep 17 00:00:00 2001 From: ahocevar Date: Thu, 23 May 2013 16:56:56 -0500 Subject: [PATCH] Fixing tests Selecting the same feature again should not do anything, which was ensured in the old implementation by a check in the SelectFeature control. This means that the previous commit causes a change in behavior in standalone mode, which I would consider a bugfix. I documented this change in the release notes. --- notes/2.13.md | 2 +- tests/Control/ModifyFeature.html | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/notes/2.13.md b/notes/2.13.md index aa1d3438e0..9425928810 100644 --- a/notes/2.13.md +++ b/notes/2.13.md @@ -44,7 +44,7 @@ The `enableKinetic` property for the DragPan control has been changed to true by ## Control.ModifyFeature: no more built-in SelectFeature control The ModifyFeature control is now much leaner, making it more reliable when combined with other controls. The most noticable change is that it has no -`selectControl` member any more. Users who previously relied on this built-in SelectFeature control will now have to create both a SelectFeature and a ModifyFeature control and configure the ModifyFeature control with `standalone: true`. To get features selected, call the `selectFeature` method e.g. from a `featureselected` listener on the vector layer. +`selectControl` member any more. Users who previously relied on this built-in SelectFeature control will now have to create both a SelectFeature and a ModifyFeature control and configure the ModifyFeature control with `standalone: true`. To get features selected, call the `selectFeature` method e.g. from a `featureselected` listener on the vector layer. Note that other than in the old implementation, calling `selectFeature` on an already selected feature will not do anything. ## Format.GPX: No more prefixes diff --git a/tests/Control/ModifyFeature.html b/tests/Control/ModifyFeature.html index 2f18a66d82..6226733707 100644 --- a/tests/Control/ModifyFeature.html +++ b/tests/Control/ModifyFeature.html @@ -225,6 +225,7 @@ // Points don't call collectVertices control.selectFeature(fakeFeature); + control.unselectFeature(fakeFeature); control.collectVertices = function() { t.ok(true, "collectVertices called"); @@ -237,7 +238,8 @@ layer.addFeatures = function(features) { t.ok(features == 'a' || features == 'd', "features passed correctly"); } - + layer.destroyFeatures = function() {}; + fakeFeature.geometry = new OpenLayers.Geometry.Polygon([ new OpenLayers.Geometry.LinearRing([ new OpenLayers.Geometry.Point(0, 0), @@ -246,7 +248,9 @@ ]); // OnSelect calls collectVertices and passes features to layer - control.selectFeature(fakeFeature); + control.selectFeature(fakeFeature); + control.unselectFeature(fakeFeature); + layer.destroyFeatures = OpenLayers.Layer.Vector.prototype.destroyFeatures; control.vertices = ['a']; control.virtualVertices = [{destroy: function() {}}];