Rename updatefeature event to changefeature

This commit is contained in:
Frederic Junod
2014-09-30 09:02:53 +02:00
parent 3285e0ddc8
commit cf8738f9f6
2 changed files with 5 additions and 5 deletions
+3 -3
View File
@@ -31,10 +31,10 @@ ol.source.VectorEventType = {
/** /**
* Triggered when a feature is updated. * Triggered when a feature is updated.
* @event ol.source.VectorEvent#updatefeature * @event ol.source.VectorEvent#changefeature
* @api * @api
*/ */
UPDATEFEATURE: 'updatefeature', CHANGEFEATURE: 'changefeature',
/** /**
* Triggered when a feature is removed from the source. * Triggered when a feature is removed from the source.
@@ -446,7 +446,7 @@ ol.source.Vector.prototype.handleFeatureChange_ = function(event) {
} }
this.changed(); this.changed();
this.dispatchEvent(new ol.source.VectorEvent( this.dispatchEvent(new ol.source.VectorEvent(
ol.source.VectorEventType.UPDATEFEATURE, feature)); ol.source.VectorEventType.CHANGEFEATURE, feature));
}; };
+2 -2
View File
@@ -242,13 +242,13 @@ describe('ol.source.Vector', function() {
expect(listener).to.be.called(); expect(listener).to.be.called();
}); });
it('fires a updatefeature event when updating a feature', function() { it('fires a changefeature event when updating a feature', function() {
var feature = new ol.Feature(new ol.geom.Point([1, 1])); var feature = new ol.Feature(new ol.geom.Point([1, 1]));
vectorSource.addFeature(feature); vectorSource.addFeature(feature);
var listener = sinon.spy(function(event) { var listener = sinon.spy(function(event) {
expect(event.feature).to.be(feature); expect(event.feature).to.be(feature);
}); });
vectorSource.on('updatefeature', listener); vectorSource.on('changefeature', listener);
feature.setStyle(null); feature.setStyle(null);
expect(listener).to.be.called(); expect(listener).to.be.called();
}); });