Dispatch change event even when geometry is set to null
This commit is contained in:
@@ -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();
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user