From 00fd5caa92b4ac52847fec75a8a1221ad295bd44 Mon Sep 17 00:00:00 2001 From: Marc Jansen Date: Tue, 1 Jul 2014 16:25:56 +0200 Subject: [PATCH] Add tests for ol.coordinate.createStringXY(). --- test/spec/ol/coordinate.test.js | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) 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() {