From 6d1c0e5ae3005b481fbb32f18746c344197cea9a Mon Sep 17 00:00:00 2001 From: Matteo Velludini Date: Wed, 15 Feb 2017 17:04:50 +0100 Subject: [PATCH] added a test for measurementSupport for leaflet --- .../__tests__/MeasurementSupport-test.jsx | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/web/client/components/map/leaflet/__tests__/MeasurementSupport-test.jsx b/web/client/components/map/leaflet/__tests__/MeasurementSupport-test.jsx index 22a1677fe6..0216d3b281 100644 --- a/web/client/components/map/leaflet/__tests__/MeasurementSupport-test.jsx +++ b/web/client/components/map/leaflet/__tests__/MeasurementSupport-test.jsx @@ -48,6 +48,27 @@ describe('Leaflet MeasurementSupport', () => { expect(cmp).toExist(); }); + it('test rendering', () => { + let map = L.map("map"); + let proj = "EPSG:3857"; + let measurement = { + geomType: null + }; + let messages = { draw: { handlers: { circle: { radius: 'Radius', tooltip: { start: 'Click and drag to draw circle.' } }, marker: { tooltip: { start: 'Click map to place marker.' } }, polygon: { tooltip: { cont: 'Click to continue drawing shape.', end: 'Click first point to close this shape.', start: 'Click to start drawing shape.' } }, polyline: { error: 'Error: shape edges cannot cross!', tooltip: { cont: 'Click to continue drawing line.', end: 'Click last point to finish line.', start: 'Click to start drawing line.' } }, rectangle: { tooltip: { start: 'Click and drag to draw rectangle.' } }, simpleshape: { tooltip: { end: 'Release mouse to finish drawing.' } } }, toolbar: { actions: { text: 'Cancel', title: 'Cancel drawing' }, buttons: { circle: 'Draw a circle', marker: 'Draw a marker', polygon: 'Draw a polygon', polyline: 'Draw a polyline', rectangle: 'Draw a rectangle' }, undo: { text: 'Delete last point', title: 'Delete last point drawn' } } }, edit: { handlers: { edit: { tooltip: { subtext: 'Click cancel to undo changes.', text: 'Drag handles, or marker to edit feature.' } }, remove: { tooltip: { text: 'Click on a feature to remove' } } }, toolbar: { actions: { cancel: { text: 'Cancel', title: 'Cancel editing, discards all changes.' }, save: { text: 'Save', title: 'Save changes.' } }, buttons: { edit: 'Edit layers.', editDisabled: 'No layers to edit.', remove: 'Delete layers.', removeDisabled: 'No layers to delete.' } } } }; + + const cmp = ReactDOM.render( + {}} + /> + , msNode); + expect(cmp).toExist(); + expect(L.drawLocal).toEqual(messages); + }); + it('test if a new layer is added to the map in order to allow drawing.', () => { let map = L.map("map", { center: [51.505, -0.09],