Skip to content

Commit 05680f0

Browse files
committed
added test
1 parent 684c204 commit 05680f0

1 file changed

Lines changed: 30 additions & 1 deletion

File tree

web/client/components/mapcontrols/mouseposition/__tests__/MousePositionLabelDMS-test.js

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,36 @@ describe('MousePositionLabelDMS', () => {
102102
expect(cmp).toExist();
103103
const cmpDom = ReactDOM.findDOMNode(cmp);
104104
expect(cmpDom).toExist();
105-
// it should be Lat: -00° 00' 21.60'' Lng: -000° 00' 21.60''
105+
// it should be Lat: -00° 00' 21.60'' Lng: -000° 00' 21.60'' instead of Lat: -01° 00' 21.60'' Lng: -001° 00' 21.60''
106106
expect(cmpDom.textContent).toBe("Lat: -00° 00' 21.60'' Lng: -000° 00' 21.60''");
107107
});
108+
it('test sign changes when crossing greenwich meridian and equator parallel and latD lngD are 0', () => {
109+
const cmp = ReactDOM.render(
110+
<IntlProvider>
111+
<MousePositionLabelDMS
112+
position={{lng: -0.006, lat: -0.006}}
113+
/>
114+
</IntlProvider>
115+
, document.getElementById("container"));
116+
expect(cmp).toExist();
117+
const cmpDom = ReactDOM.findDOMNode(cmp);
118+
expect(cmpDom).toExist();
119+
120+
// it should be Lat: -00° 00' 21.60'' Lng: -000° 00' 21.60''
121+
expect(cmpDom.textContent).toBe("Lat: -00° 00' 21.60'' Lng: -000° 00' 21.60''");
122+
123+
const cmpPositive = ReactDOM.render(
124+
<IntlProvider>
125+
<MousePositionLabelDMS
126+
position={{lng: 0.006, lat: 0.006}}
127+
/>
128+
</IntlProvider>
129+
, document.getElementById("container"));
130+
expect(cmpPositive).toExist();
131+
const cmpDomPositive = ReactDOM.findDOMNode(cmpPositive);
132+
expect(cmpDomPositive).toExist();
133+
134+
// it should be Lat: 00° 00' 21.60'' Lng: 000° 00' 21.60'' instead of Lat: -00° 00' 21.60'' Lng: -000° 00' 21.60''
135+
expect(cmpDomPositive.textContent).toBe("Lat: 00° 00' 21.60'' Lng: 000° 00' 21.60''");
136+
});
108137
});

0 commit comments

Comments
 (0)