Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bump leaflet version for tests to 1.0.0-rc.1
- Loading branch information
Showing
6 changed files
with
223 additions
and
214 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,59 +1,59 @@ | ||
function cloneLayer(layer) { | ||
var options = layer.options; | ||
function cloneLayer (layer) { | ||
var options = layer.options; | ||
|
||
// Tile layers | ||
if (layer instanceof L.TileLayer) { | ||
return L.tileLayer(layer._url, options); | ||
} | ||
if (layer instanceof L.ImageOverlay) { | ||
return L.imageOverlay(layer._url, layer._bounds, options); | ||
} | ||
// Tile layers | ||
if (layer instanceof L.TileLayer) { | ||
return L.tileLayer(layer._url, options); | ||
} | ||
if (layer instanceof L.ImageOverlay) { | ||
return L.imageOverlay(layer._url, layer._bounds, options); | ||
} | ||
|
||
// Marker layers | ||
if (layer instanceof L.Marker) { | ||
return L.marker(layer.getLatLng(), options); | ||
} | ||
if (layer instanceof L.circleMarker) { | ||
return L.circleMarker(layer.getLatLng(), options); | ||
} | ||
// Marker layers | ||
if (layer instanceof L.Marker) { | ||
return L.marker(layer.getLatLng(), options); | ||
} | ||
if (layer instanceof L.circleMarker) { | ||
return L.circleMarker(layer.getLatLng(), options); | ||
} | ||
|
||
// Vector layers | ||
if (layer instanceof L.Rectangle) { | ||
return L.rectangle(layer.getBounds(), options); | ||
} | ||
if (layer instanceof L.Polygon) { | ||
return L.polygon(layer.getLatLngs(), options); | ||
} | ||
if (layer instanceof L.Polyline) { | ||
return L.polyline(layer.getLatLngs(), options); | ||
} | ||
// MultiPolyline is removed in leaflet 0.8-dev | ||
if (L.MultiPolyline && layer instanceof L.MultiPolyline) { | ||
return L.polyline(layer.getLatLngs(), options); | ||
} | ||
// MultiPolygon is removed in leaflet 0.8-dev | ||
if (L.MultiPolygon && layer instanceof L.MultiPolygon) { | ||
return L.multiPolygon(layer.getLatLngs(), options); | ||
} | ||
if (layer instanceof L.Circle) { | ||
return L.circle(layer.getLatLng(), layer.getRadius(), options); | ||
} | ||
if (layer instanceof L.GeoJSON) { | ||
return L.geoJson(layer.toGeoJSON(), options); | ||
} | ||
// Vector layers | ||
if (layer instanceof L.Rectangle) { | ||
return L.rectangle(layer.getBounds(), options); | ||
} | ||
if (layer instanceof L.Polygon) { | ||
return L.polygon(layer.getLatLngs(), options); | ||
} | ||
if (layer instanceof L.Polyline) { | ||
return L.polyline(layer.getLatLngs(), options); | ||
} | ||
// MultiPolyline is removed in leaflet 1.0.0 | ||
if (L.MultiPolyline && layer instanceof L.MultiPolyline) { | ||
return L.polyline(layer.getLatLngs(), options); | ||
} | ||
// MultiPolygon is removed in leaflet 1.0.0 | ||
if (L.MultiPolygon && layer instanceof L.MultiPolygon) { | ||
return L.multiPolygon(layer.getLatLngs(), options); | ||
} | ||
if (layer instanceof L.Circle) { | ||
return L.circle(layer.getLatLng(), layer.getRadius(), options); | ||
} | ||
if (layer instanceof L.GeoJSON) { | ||
return L.geoJson(layer.toGeoJSON(), options); | ||
} | ||
|
||
// layer/feature groups | ||
if (layer instanceof L.LayerGroup || layer instanceof L.FeatureGroup) { | ||
var layergroup = L.layerGroup(); | ||
layer.eachLayer(function (inner) { | ||
layergroup.addLayer(cloneLayer(inner)); | ||
}); | ||
return layergroup; | ||
} | ||
// layer/feature groups | ||
if (layer instanceof L.LayerGroup || layer instanceof L.FeatureGroup) { | ||
var layergroup = L.layerGroup(); | ||
layer.eachLayer(function (inner) { | ||
layergroup.addLayer(cloneLayer(inner)); | ||
}); | ||
return layergroup; | ||
} | ||
|
||
throw 'Unknown layer, cannot clone this layer'; | ||
throw 'Unknown layer, cannot clone this layer'; | ||
} | ||
|
||
if (typeof exports === 'object') { | ||
module.exports = cloneLayer; | ||
module.exports = cloneLayer; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,32 @@ | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>leaflet-clonelayer Tests</title> | ||
<link rel="stylesheet" href="../node_modules/mocha/mocha.css" /> | ||
<meta charset="utf-8"> | ||
<title>leaflet-clonelayer Tests</title> | ||
<link rel="stylesheet" href="../node_modules/mocha/mocha.css" /> | ||
|
||
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.css" /> | ||
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet/v1.0.0-rc.1/leaflet.css" /> | ||
</head> | ||
<body> | ||
<div id="mocha"></div> | ||
<div id="mocha"></div> | ||
|
||
<script src="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.js"></script> | ||
<script src="http://cdn.leafletjs.com/leaflet/v1.0.0-rc.1/leaflet.js"></script> | ||
|
||
<script src="../node_modules/chai/chai.js"></script> | ||
<script src="../node_modules/mocha/mocha.js"></script> | ||
<script src="../node_modules/chai/chai.js"></script> | ||
<script src="../node_modules/mocha/mocha.js"></script> | ||
<script src="../node_modules/chai-leaflet/chai-leaflet.js"></script> | ||
|
||
<script src="../index.js"></script> | ||
|
||
<script> | ||
mocha.setup('bdd'); | ||
</script> | ||
<script src="../index.js"></script> | ||
|
||
<script src="spec.js"></script> | ||
<script> | ||
window.initMochaPhantomJS(); | ||
mocha.setup('bdd'); | ||
</script> | ||
|
||
<script> | ||
mocha.globals(['L']); | ||
(window.mochaPhantomJS || mocha).run(); | ||
</script> | ||
<script src="spec.js"></script> | ||
|
||
<script> | ||
mocha.globals(['L']); | ||
(window.mochaPhantomJS || mocha).run(); | ||
</script> | ||
</body> | ||
</html> |
Oops, something went wrong.