Remove uniqueness constraint check

This commit is contained in:
Frederic Junod
2014-06-26 17:55:38 +02:00
parent d1737228e9
commit a172eda242
2 changed files with 7 additions and 16 deletions

View File

@@ -338,27 +338,25 @@ describe('ol.source.Vector', function() {
source = new ol.source.Vector();
});
it('enforces a uniqueness constraint (on add)', function() {
it('allows adding feature with the same id', function() {
var feature = new ol.Feature();
feature.setId('foo');
source.addFeature(feature);
var dupe = new ol.Feature();
dupe.setId('foo');
expect(function() {
source.addFeature(dupe);
}).to.throwException();
source.addFeature(dupe);
expect(source.getFeatureById('foo')).to.be(dupe);
});
it('enforces a uniqueness constraint (on change)', function() {
it('allows changing feature and set the same id', function() {
var foo = new ol.Feature();
foo.setId('foo');
source.addFeature(foo);
var bar = new ol.Feature();
bar.setId('bar');
source.addFeature(bar);
expect(function() {
bar.setId('foo');
}).to.throwException();
bar.setId('foo');
expect(source.getFeatureById('foo')).to.be(bar);
});
});