From 116b107cb20f98dc707c1002cb057ea713291c18 Mon Sep 17 00:00:00 2001 From: Frederic Junod Date: Wed, 6 Nov 2013 09:00:43 +0100 Subject: [PATCH] Add tests for ol.coordinate.format --- test/spec/ol/coordinate.test.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/test/spec/ol/coordinate.test.js b/test/spec/ol/coordinate.test.js index 5407ff1634..20dde14807 100644 --- a/test/spec/ol/coordinate.test.js +++ b/test/spec/ol/coordinate.test.js @@ -2,6 +2,23 @@ goog.provide('ol.test.coordinate'); describe('ol.coordinate', function() { + describe('#format', function() { + var coordinate; + beforeEach(function() { + coordinate = [6.6123, 46.7919]; + }); + + it('rounds the values', function() { + var string = ol.coordinate.format(coordinate, '{x} {y}', 0); + expect(string).to.eql('7 47'); + }); + + it('handles the optional fractionDigits param', function() { + var string = ol.coordinate.format(coordinate, '{x} {y}', 3); + expect(string).to.eql('6.612 46.792'); + }); + }); + describe('#closestOnSegment', function() { it('can handle points where the foot of the perpendicular is closest', function() {