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) {
3030 objClass . defaultFunction = objClass . prototype . toGeoJSON ;
3131 objClass . include ( {
3232 toGeoJSON : function ( precision ) {
33- return objClass . defaultFunction . call ( this , precision || 10 ) ;
33+ return objClass . defaultFunction . call ( this , precision || L . toGeoJSONPrecision || 15 ) ;
3434 }
3535 } )
3636 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';
55import './leaflet/core/NonEarthCRSSpec.js' ;
66import './leaflet/core/TransformUtilSpec.js' ;
77import './leaflet/core/Proj4LeafletSpec.js' ;
8+ import './leaflet/core/BaseSpec.js' ;
89
910/*leaflet -- mapping*/
1011import './leaflet/mapping/ImageMapLayerSpec.js' ;
You can’t perform that action at this time.
0 commit comments