From cffa5c09dc25e5f1303163cce4ff0b5fd3050d2a Mon Sep 17 00:00:00 2001 From: saidaipparla Date: Mon, 17 Oct 2016 16:11:55 +0200 Subject: [PATCH 1/2] fix #1135 added floor method to get back real value --- .../mapcontrols/mouseposition/MousePositionLabelDMS.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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) }; From 3a8d4df470c3603518ef8b1ea534cd0a534952ee Mon Sep 17 00:00:00 2001 From: saidaipparla Date: Mon, 17 Oct 2016 16:48:40 +0200 Subject: [PATCH 2/2] fix added test --- .../__tests__/MousePosition-test.js | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) 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); + }); + });