Make addFeature(s) ignore features with same id

This commit is contained in:
Éric Lemoine
2015-04-04 16:54:16 +02:00
parent bb0ee1e6e9
commit c3658de75a
2 changed files with 33 additions and 12 deletions

View File

@@ -371,14 +371,15 @@ describe('ol.source.Vector', function() {
source = new ol.source.Vector();
});
it('allows adding feature with the same id', function() {
it('ignores features with the same id', function() {
var feature = new ol.Feature();
feature.setId('foo');
source.addFeature(feature);
var dupe = new ol.Feature();
dupe.setId('foo');
source.addFeature(dupe);
expect(source.getFeatureById('foo')).to.be(dupe);
expect(source.getFeatures()).to.have.length(1);
expect(source.getFeatureById('foo')).to.be(feature);
});
it('allows changing feature and set the same id', function() {