diff --git a/test/spec/ol/geom/linestring.test.js b/test/spec/ol/geom/linestring.test.js index 8c7b73d897..25e28493cd 100644 --- a/test/spec/ol/geom/linestring.test.js +++ b/test/spec/ol/geom/linestring.test.js @@ -73,6 +73,12 @@ describe('ol.geom.LineString', function() { expect(lineString.getStride()).to.be(2); }); + describe('#intersectsCoordinate', function() { + it('returns true for an intersecting coordinate', function() { + expect(lineString.intersectsCoordinate([1.5, 2.5])).to.be(true); + }); + }); + describe('#intersectsExtent', function() { it('return false for non matching extent', function() { @@ -89,6 +95,23 @@ describe('ol.geom.LineString', function() { }); + describe('#intersectsCoordinate', function() { + + it('detects intersecting coordinates', function() { + expect(lineString.intersectsCoordinate([1, 2])).to.be(true); + }); + + }); + + describe('#getClosestPoint', function() { + + it('uses existing vertices', function() { + const closestPoint = lineString.getClosestPoint([0.9, 1.8]); + expect(closestPoint).to.eql([1, 2]); + }); + + }); + describe('#getCoordinateAt', function() { it('return the first point when fraction is 0', function() {