diff --git a/web/client/components/mapcontrols/mouseposition/MousePositionLabelDMS.jsx b/web/client/components/mapcontrols/mouseposition/MousePositionLabelDMS.jsx index 475b175ffb..e756f70eef 100644 --- a/web/client/components/mapcontrols/mouseposition/MousePositionLabelDMS.jsx +++ b/web/client/components/mapcontrols/mouseposition/MousePositionLabelDMS.jsx @@ -23,10 +23,10 @@ var MousePositionLabelDMS = React.createClass({ let [latM, lngM] = [(lat % 1) * 60, (lng % 1) * 60]; let [latS, lngS] = [(latM % 1) * 60, (lngM % 1) * 60]; return { - lat, + lat: Math.floor(lat), latM: Math.abs(latM), latS: Math.abs(latS), - lng, + lng: Math.floor(lng), lngM: Math.abs(lngM), lngS: Math.abs(lngS) }; diff --git a/web/client/components/mapcontrols/mouseposition/__tests__/MousePosition-test.js b/web/client/components/mapcontrols/mouseposition/__tests__/MousePosition-test.js index cb814e8142..12d5027dc7 100644 --- a/web/client/components/mapcontrols/mouseposition/__tests__/MousePosition-test.js +++ b/web/client/components/mapcontrols/mouseposition/__tests__/MousePosition-test.js @@ -137,4 +137,31 @@ describe('MousePosition', () => { expect(spy.calls.length).toBe(1); }); + it('checks lat ang lag value', () => { + + // creating a copy to clipboard callback to spy on + const actions = { + onCopy: () => {} + }; + let spy = expect.spyOn(actions, "onCopy"); + + // instaciating mouse position plugin + const cmp = ReactDOM.render(, document.getElementById("container")); + // getting the copy to clipboard button + const cmpDom = ReactDOM.findDOMNode(cmp); + const button = cmpDom.getElementsByTagName('button')[0]; + + // if propmt for ctrl+c we accept + expect.spyOn(window, 'prompt').andReturn(true); + + // checking copy to clipboard invocation + button.click(); + expect(spy.calls.length).toBe(1); + }); + });