@@ -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