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.
This commit is contained in:
ahocevar
2013-05-23 16:56:56 -05:00
committed by Bart van den Eijnden
parent b103d3b428
commit a5ea8d7fcf
2 changed files with 7 additions and 3 deletions
+1 -1
View File
@@ -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 ## 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 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 ## Format.GPX: No more prefixes
+6 -2
View File
@@ -225,6 +225,7 @@
// Points don't call collectVertices // Points don't call collectVertices
control.selectFeature(fakeFeature); control.selectFeature(fakeFeature);
control.unselectFeature(fakeFeature);
control.collectVertices = function() { control.collectVertices = function() {
t.ok(true, "collectVertices called"); t.ok(true, "collectVertices called");
@@ -237,7 +238,8 @@
layer.addFeatures = function(features) { layer.addFeatures = function(features) {
t.ok(features == 'a' || features == 'd', "features passed correctly"); t.ok(features == 'a' || features == 'd', "features passed correctly");
} }
layer.destroyFeatures = function() {};
fakeFeature.geometry = new OpenLayers.Geometry.Polygon([ fakeFeature.geometry = new OpenLayers.Geometry.Polygon([
new OpenLayers.Geometry.LinearRing([ new OpenLayers.Geometry.LinearRing([
new OpenLayers.Geometry.Point(0, 0), new OpenLayers.Geometry.Point(0, 0),
@@ -246,7 +248,9 @@
]); ]);
// OnSelect calls collectVertices and passes features to layer // 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.vertices = ['a'];
control.virtualVertices = [{destroy: function() {}}]; control.virtualVertices = [{destroy: function() {}}];