Adding original properties to cloned geometry
This commit is contained in:
@@ -9,11 +9,14 @@ describe('ol.geom.Circle', function () {
|
||||
|
||||
describe('#clone', function () {
|
||||
it('returns a clone', function () {
|
||||
circle.setProperties({foo: 'bar', baz: null});
|
||||
|
||||
const clone = circle.clone();
|
||||
expect(clone).to.be.an(Circle);
|
||||
expect(clone.getCenter()).to.eql(circle.getCenter());
|
||||
expect(clone.getCenter()).not.to.be(circle.getCenter());
|
||||
expect(clone.getRadius()).to.be(circle.getRadius());
|
||||
expect(clone.getProperties()).to.eql({foo: 'bar', baz: null});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -97,6 +97,7 @@ describe('ol.geom.GeometryCollection', function () {
|
||||
]);
|
||||
const poly = new Polygon([outer, inner1, inner2]);
|
||||
const multi = new GeometryCollection([point, line, poly]);
|
||||
multi.setProperties({foo: 'bar', baz: null});
|
||||
const clone = multi.clone();
|
||||
expect(clone).to.not.be(multi);
|
||||
const geometries = clone.getGeometries();
|
||||
@@ -106,6 +107,7 @@ describe('ol.geom.GeometryCollection', function () {
|
||||
[30, 40],
|
||||
]);
|
||||
expect(geometries[2].getCoordinates()).to.eql([outer, inner1, inner2]);
|
||||
expect(clone.getProperties()).to.eql({foo: 'bar', baz: null});
|
||||
});
|
||||
|
||||
it('does a deep clone', function () {
|
||||
|
||||
@@ -276,8 +276,11 @@ describe('ol.geom.MultiPolygon', function () {
|
||||
|
||||
describe('#clone()', function () {
|
||||
it('has the expected endss_', function () {
|
||||
multiPolygon.setProperties({foo: 'bar', baz: null});
|
||||
|
||||
const clone = multiPolygon.clone();
|
||||
expect(multiPolygon.endss_).to.eql(clone.endss_);
|
||||
expect(clone.getProperties()).to.eql({foo: 'bar', baz: null});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user