Do not implement a specific clone method

What we need here is a mix of deep and shallow cloning, and we
do not want to do this in a generic ol.Feature#clone() method.
This commit is contained in:
ahocevar
2013-08-28 19:18:17 +02:00
parent 2394b39f6f
commit 0c1f2328f9
3 changed files with 6 additions and 35 deletions

View File

@@ -34,24 +34,6 @@ describe('ol.Feature', function() {
});
describe('#clone()', function() {
it('creates a clone with a cloned geometry', function() {
var feature = new ol.Feature({
loc: new ol.geom.Point([10, 20]),
foo: 'bar'
});
feature.setFeatureId('foo');
var clone = feature.clone();
expect(clone).to.not.be(feature);
expect(clone.get('foo')).to.be('bar');
expect(clone.getFeatureId()).to.be('foo');
expect(clone.getGeometry()).to.not.be(feature.getGeometry());
expect(clone.getGeometry().getCoordinates()).to.eql([10, 20]);
});
});
describe('#get()', function() {
it('returns values set at construction', function() {