Skip to content

Commit

Permalink
added a test for measurementSupport for leaflet
Browse files Browse the repository at this point in the history
  • Loading branch information
MV88 committed Feb 15, 2017
1 parent e62a337 commit 6d1c0e5
Showing 1 changed file with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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: '<strong>Error:</strong> 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(
<MeasurementSupport
projection={proj}
map={map}
measurement={measurement}
messages={messages}
changeMeasurementState={() => {}}
/>
, 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],
Expand Down

0 comments on commit 6d1c0e5

Please sign in to comment.