File tree Expand file tree Collapse file tree 3 files changed +16
-1
lines changed Expand file tree Collapse file tree 3 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ function wrapToGeoJSON(objClassArray) {
30
30
objClass . defaultFunction = objClass . prototype . toGeoJSON ;
31
31
objClass . include ( {
32
32
toGeoJSON : function ( precision ) {
33
- return objClass . defaultFunction . call ( this , precision || 10 ) ;
33
+ return objClass . defaultFunction . call ( this , precision || L . toGeoJSONPrecision || 15 ) ;
34
34
}
35
35
} )
36
36
return objClass ;
Original file line number Diff line number Diff line change
1
+ import '../../../src/leaflet/core/Base' ;
2
+ import L from "leaflet" ;
3
+
4
+ describe ( 'Base' , ( ) => {
5
+ it ( "toGeoJSON precision" , ( ) => {
6
+ const p = L . marker ( [ 10.12345678912345 , 4.12345678912345 ] ) ;
7
+ expect ( p . toGeoJSON ( ) . geometry . coordinates [ 0 ] ) . toEqual ( 4.12345678912345 ) ;
8
+ } ) ;
9
+ it ( "toGeoJSON toGeoJSONPrecision" , ( ) => {
10
+ L . toGeoJSONPrecision = 8 ;
11
+ const p = L . marker ( [ 10.12345678912345 , 4.12345678912345 ] ) ;
12
+ expect ( p . toGeoJSON ( ) . geometry . coordinates [ 0 ] ) . toEqual ( 4.12345679 ) ;
13
+ } ) ;
14
+ } ) ;
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import './leaflet/control/ChangeTileVersionSpec.js';
5
5
import './leaflet/core/NonEarthCRSSpec.js' ;
6
6
import './leaflet/core/TransformUtilSpec.js' ;
7
7
import './leaflet/core/Proj4LeafletSpec.js' ;
8
+ import './leaflet/core/BaseSpec.js' ;
8
9
9
10
/*leaflet -- mapping*/
10
11
import './leaflet/mapping/ImageMapLayerSpec.js' ;
You can’t perform that action at this time.
0 commit comments