Avoid unexpected behavior when passing string coordinates

This commit is contained in:
ahocevar
2018-12-12 22:30:58 +01:00
parent e426af29c2
commit 80ebb8142c
4 changed files with 17 additions and 3 deletions

View File

@@ -29,6 +29,14 @@ describe('ol.coordinate', function() {
expect(coordinate[0]).to.eql(48.73);
expect(coordinate[1]).to.eql(10.1);
});
it('does not produce unexpected results with string delta values', function() {
addCoordinate(coordinate, delta.map(function(n) {
return String(n);
}));
expect(coordinate[0]).to.eql(48.73);
expect(coordinate[1]).to.eql(10.1);
});
});
describe('#equals', function() {

View File

@@ -35,6 +35,12 @@ describe('ol/proj/epsg3857', function() {
}
});
it('does not produce unexpected results for string coordinates', function() {
const transformed = fromEPSG4326(['180', '90']);
expect(transformed[0]).to.roughlyEqual(HALF_SIZE, 1e-5);
expect(transformed[1]).to.roughlyEqual(HALF_SIZE, 1e-5);
});
});
describe('getPointResolution', function() {