Dispatch change event even when geometry is set to null

This commit is contained in:
Pierre GIRAUD
2015-04-07 11:54:46 +02:00
parent 0789604e88
commit 5eb13660d3
2 changed files with 14 additions and 1 deletions

View File

@@ -218,8 +218,8 @@ ol.Feature.prototype.handleGeometryChanged_ = function() {
if (goog.isDefAndNotNull(geometry)) {
this.geometryChangeKey_ = goog.events.listen(geometry,
goog.events.EventType.CHANGE, this.handleGeometryChange_, false, this);
this.changed();
}
this.changed();
};

View File

@@ -416,6 +416,19 @@ describe('ol.Feature', function() {
});
});
describe('#setGeometry()', function() {
it('dispatches a change event when geometry is set to null',
function() {
var feature = new ol.Feature({
geometry: new ol.geom.Point([0, 0])
});
var spy = sinon.spy();
feature.on('change', spy);
feature.setGeometry(null);
expect(spy.callCount).to.be(1);
});
});
});