@@ -25,7 +25,6 @@ describe('MousePositionLabelDMS', () => {
2525 } ) ;
2626
2727 it ( 'checks default' , ( ) => {
28-
2928 const cmp = ReactDOM . render (
3029 < MousePositionLabelDMS />
3130 , document . getElementById ( "container" ) ) ;
@@ -70,7 +69,6 @@ describe('MousePositionLabelDMS', () => {
7069
7170 const cmpDom = ReactDOM . findDOMNode ( cmp ) ;
7271 expect ( cmpDom ) . toExist ( ) ;
73-
7472 expect ( cmpDom . textContent ) . toBe ( "Lat: 13° 31' 60.00'' Lng: 028° 18' 00.00''" ) ;
7573 } ) ;
7674
@@ -104,8 +102,36 @@ describe('MousePositionLabelDMS', () => {
104102 expect ( cmp ) . toExist ( ) ;
105103 const cmpDom = ReactDOM . findDOMNode ( cmp ) ;
106104 expect ( cmpDom ) . toExist ( ) ;
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''
106+ expect ( cmpDom . textContent ) . toBe ( "Lat: -00° 00' 21.60'' Lng: -000° 00' 21.60''" ) ;
107+ } ) ;
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 ( ) ;
107119
108- // it should be 010° 28' 30.05 '' instead of 010° 29' 00 ''
120+ // it should be Lat: -00° 00' 21.60 '' Lng: -000° 00' 21.60 ''
109121 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''" ) ;
110136 } ) ;
111137} ) ;
0 commit comments