diff --git a/test/spec/ol/coordinate.test.js b/test/spec/ol/coordinate.test.js index f6eb6a3f25..44ad38b00c 100644 --- a/test/spec/ol/coordinate.test.js +++ b/test/spec/ol/coordinate.test.js @@ -47,6 +47,35 @@ describe('ol.coordinate', function() { }); }); + describe('#createStringXY', function() { + var coordinate, + created, + formatted; + beforeEach(function() { + coordinate = [6.6123, 46.7919]; + created = null; + formatted = null; + }); + + it('returns a CoordinateFormatType', function() { + created = ol.coordinate.createStringXY(); + expect(created).to.be.a('function'); + + formatted = created(coordinate); + expect(formatted).to.be.a('string'); + expect(formatted).to.eql('7, 47'); + }); + + it('respects opt_fractionDigits', function() { + created = ol.coordinate.createStringXY(3); + expect(created).to.be.a('function'); + + formatted = created(coordinate); + expect(formatted).to.be.a('string'); + expect(formatted).to.eql('6.612, 46.792'); + }); + }); + describe('#closestOnSegment', function() { it('can handle points where the foot of the perpendicular is closest', function() {