[Pkg-javascript-commits] [leaflet-markercluster] 17/128: Merged new commits and corrected all test suites
Jonas Smedegaard
dr at jones.dk
Sun Apr 16 06:25:59 UTC 2017
This is an automated email from the git hooks/post-receive script.
js pushed a commit to branch master
in repository leaflet-markercluster.
commit b0e2acf27f63c37479669b4e761c51c542c6647a
Author: ghybs <ghybs1 at gmail.com>
Date: Thu Nov 19 09:37:06 2015 +0400
Merged new commits and corrected all test suites
for compatibility with Leaflet 1.0.
Updated all example pages with correct CDN link to Leaflet 1.0.0-beta.2 assets.
Corrected MarkerCluster.Spidefier to avoid trying to setOpacity and setZindexOffset on L.Circle (these can be clustered and spiderfied, but they do not have those methods).
All tests should pass now and Leaflet-master could be updated.
---
example/geojson.html | 4 +-
example/marker-clustering-convexhull.html | 4 +-
example/marker-clustering-custom.html | 4 +-
example/marker-clustering-everything.html | 4 +-
example/marker-clustering-geojson.html | 4 +-
.../marker-clustering-realworld-maxzoom.388.html | 4 +-
.../marker-clustering-realworld-mobile.388.html | 4 +-
example/marker-clustering-realworld.10000.html | 4 +-
example/marker-clustering-realworld.388.html | 4 +-
example/marker-clustering-realworld.50000.html | 4 +-
example/marker-clustering-singlemarkermode.html | 4 +-
example/marker-clustering-spiderfier.html | 4 +-
example/marker-clustering-zoomtobounds.html | 4 +-
example/marker-clustering-zoomtoshowlayer.html | 4 +-
example/marker-clustering.html | 4 +-
example/old-bugs/add-1000-after.html | 2 +-
example/old-bugs/add-markers-offscreen.html | 2 +-
example/old-bugs/add-remove-before-addtomap.html | 2 +-
example/old-bugs/animationless-zoom.html | 2 +-
example/old-bugs/click-cluster-at-screen-edge.html | 2 +-
.../old-bugs/disappearing-marker-from-spider.html | 4 +-
.../doesnt-update-cluster-on-bottom-level.html | 2 +-
example/old-bugs/remove-add-clustering.html | 2 +-
example/old-bugs/remove-when-spiderfied.html | 2 +-
.../removelayer-after-remove-from-map.html | 2 +-
example/old-bugs/setView-doesnt-remove.html | 2 +-
.../zoomtoshowlayer-doesnt-need-to-zoom.html | 2 +-
...zoomtoshowlayer-doesnt-zoom-if-centered-on.html | 2 +-
example/remove-geoJSON-when-spiderfied.html | 2 +-
spec/suites/CircleMarkerSupportSpec.js | 133 ++++++++++++++------
spec/suites/CircleSupportSpec.js | 129 ++++++++++++++-----
spec/suites/NonPointSpec.js | 139 ++++++++++++++++-----
spec/suites/RememberOpacity.js | 2 +-
spec/suites/eventsSpec.js | 124 +++++++++++++-----
spec/suites/removeOutsideVisibleBoundsSpec.js | 14 ++-
spec/suites/spiderfySpec.js | 104 +++++++++++----
src/MarkerCluster.Spiderfier.js | 9 +-
src/MarkerClusterGroup.js | 5 +-
38 files changed, 545 insertions(+), 204 deletions(-)
diff --git a/example/geojson.html b/example/geojson.html
index a074eec..740ae23 100644
--- a/example/geojson.html
+++ b/example/geojson.html
@@ -3,8 +3,8 @@
<head>
<title>Leaflet debug page</title>
- <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7/leaflet.css" />
- <script src="http://cdn.leafletjs.com/leaflet-0.7/leaflet.js"></script>
+ <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet/v1.0.0-beta.2/leaflet.css" />
+ <script src="http://cdn.leafletjs.com/leaflet/v1.0.0-beta.2/leaflet.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="screen.css" />
diff --git a/example/marker-clustering-convexhull.html b/example/marker-clustering-convexhull.html
index 25ee56d..55cc6c8 100644
--- a/example/marker-clustering-convexhull.html
+++ b/example/marker-clustering-convexhull.html
@@ -3,8 +3,8 @@
<head>
<title>Leaflet debug page</title>
- <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7/leaflet.css" />
- <script src="http://cdn.leafletjs.com/leaflet-0.7/leaflet.js"></script>
+ <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet/v1.0.0-beta.2/leaflet.css" />
+ <script src="http://cdn.leafletjs.com/leaflet/v1.0.0-beta.2/leaflet.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="screen.css" />
diff --git a/example/marker-clustering-custom.html b/example/marker-clustering-custom.html
index f53d81f..61d926d 100644
--- a/example/marker-clustering-custom.html
+++ b/example/marker-clustering-custom.html
@@ -3,8 +3,8 @@
<head>
<title>Leaflet debug page</title>
- <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7/leaflet.css" />
- <script src="http://cdn.leafletjs.com/leaflet-0.7/leaflet.js"></script>
+ <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet/v1.0.0-beta.2/leaflet.css" />
+ <script src="http://cdn.leafletjs.com/leaflet/v1.0.0-beta.2/leaflet.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="screen.css" />
diff --git a/example/marker-clustering-everything.html b/example/marker-clustering-everything.html
index cd1e727..010cc5b 100644
--- a/example/marker-clustering-everything.html
+++ b/example/marker-clustering-everything.html
@@ -3,8 +3,8 @@
<head>
<title>Leaflet debug page</title>
- <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7/leaflet.css" />
- <script src="http://cdn.leafletjs.com/leaflet-0.7/leaflet.js"></script>
+ <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet/v1.0.0-beta.2/leaflet.css" />
+ <script src="http://cdn.leafletjs.com/leaflet/v1.0.0-beta.2/leaflet.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="screen.css" />
diff --git a/example/marker-clustering-geojson.html b/example/marker-clustering-geojson.html
index 1912ae8..5f938ab 100644
--- a/example/marker-clustering-geojson.html
+++ b/example/marker-clustering-geojson.html
@@ -3,8 +3,8 @@
<head>
<title>Leaflet debug page</title>
- <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7/leaflet.css" />
- <script src="http://cdn.leafletjs.com/leaflet-0.7/leaflet.js"></script>
+ <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet/v1.0.0-beta.2/leaflet.css" />
+ <script src="http://cdn.leafletjs.com/leaflet/v1.0.0-beta.2/leaflet.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="screen.css" />
diff --git a/example/marker-clustering-realworld-maxzoom.388.html b/example/marker-clustering-realworld-maxzoom.388.html
index 669b23a..a490b52 100644
--- a/example/marker-clustering-realworld-maxzoom.388.html
+++ b/example/marker-clustering-realworld-maxzoom.388.html
@@ -3,8 +3,8 @@
<head>
<title>Leaflet debug page</title>
- <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7/leaflet.css" />
- <script src="http://cdn.leafletjs.com/leaflet-0.7/leaflet.js"></script>
+ <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet/v1.0.0-beta.2/leaflet.css" />
+ <script src="http://cdn.leafletjs.com/leaflet/v1.0.0-beta.2/leaflet.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="screen.css" />
diff --git a/example/marker-clustering-realworld-mobile.388.html b/example/marker-clustering-realworld-mobile.388.html
index 0a8d07f..ade3751 100644
--- a/example/marker-clustering-realworld-mobile.388.html
+++ b/example/marker-clustering-realworld-mobile.388.html
@@ -3,8 +3,8 @@
<head>
<title>Leaflet debug page</title>
- <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7/leaflet.css" />
- <script src="http://cdn.leafletjs.com/leaflet-0.7/leaflet.js"></script>
+ <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet/v1.0.0-beta.2/leaflet.css" />
+ <script src="http://cdn.leafletjs.com/leaflet/v1.0.0-beta.2/leaflet.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<link rel="stylesheet" href="mobile.css" />
diff --git a/example/marker-clustering-realworld.10000.html b/example/marker-clustering-realworld.10000.html
index ab12a80..0010414 100644
--- a/example/marker-clustering-realworld.10000.html
+++ b/example/marker-clustering-realworld.10000.html
@@ -3,8 +3,8 @@
<head>
<title>Leaflet debug page</title>
- <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7/leaflet.css" />
- <script src="http://cdn.leafletjs.com/leaflet-0.7/leaflet.js"></script>
+ <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet/v1.0.0-beta.2/leaflet.css" />
+ <script src="http://cdn.leafletjs.com/leaflet/v1.0.0-beta.2/leaflet.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="screen.css" />
diff --git a/example/marker-clustering-realworld.388.html b/example/marker-clustering-realworld.388.html
index c827a51..a7ec03f 100644
--- a/example/marker-clustering-realworld.388.html
+++ b/example/marker-clustering-realworld.388.html
@@ -3,8 +3,8 @@
<head>
<title>Leaflet debug page</title>
- <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7/leaflet.css" />
- <script src="http://cdn.leafletjs.com/leaflet-0.7/leaflet.js"></script>
+ <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet/v1.0.0-beta.2/leaflet.css" />
+ <script src="http://cdn.leafletjs.com/leaflet/v1.0.0-beta.2/leaflet.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="screen.css" />
diff --git a/example/marker-clustering-realworld.50000.html b/example/marker-clustering-realworld.50000.html
index d84a573..f10f69b 100644
--- a/example/marker-clustering-realworld.50000.html
+++ b/example/marker-clustering-realworld.50000.html
@@ -3,8 +3,8 @@
<head>
<title>Leaflet debug page</title>
- <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7/leaflet.css" />
- <script src="http://cdn.leafletjs.com/leaflet-0.7/leaflet.js"></script>
+ <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet/v1.0.0-beta.2/leaflet.css" />
+ <script src="http://cdn.leafletjs.com/leaflet/v1.0.0-beta.2/leaflet.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="screen.css" />
diff --git a/example/marker-clustering-singlemarkermode.html b/example/marker-clustering-singlemarkermode.html
index 7f5c1a2..03a56ac 100644
--- a/example/marker-clustering-singlemarkermode.html
+++ b/example/marker-clustering-singlemarkermode.html
@@ -3,8 +3,8 @@
<head>
<title>Leaflet debug page</title>
- <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7/leaflet.css" />
- <script src="http://cdn.leafletjs.com/leaflet-0.7/leaflet.js"></script>
+ <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet/v1.0.0-beta.2/leaflet.css" />
+ <script src="http://cdn.leafletjs.com/leaflet/v1.0.0-beta.2/leaflet.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="screen.css" />
diff --git a/example/marker-clustering-spiderfier.html b/example/marker-clustering-spiderfier.html
index b4cc5f0..ccbeaa2 100644
--- a/example/marker-clustering-spiderfier.html
+++ b/example/marker-clustering-spiderfier.html
@@ -3,8 +3,8 @@
<head>
<title>Leaflet debug page</title>
- <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7/leaflet.css" />
- <script src="http://cdn.leafletjs.com/leaflet-0.7/leaflet.js"></script>
+ <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet/v1.0.0-beta.2/leaflet.css" />
+ <script src="http://cdn.leafletjs.com/leaflet/v1.0.0-beta.2/leaflet.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="screen.css" />
diff --git a/example/marker-clustering-zoomtobounds.html b/example/marker-clustering-zoomtobounds.html
index 0f4e209..8b3e1ac 100644
--- a/example/marker-clustering-zoomtobounds.html
+++ b/example/marker-clustering-zoomtobounds.html
@@ -3,8 +3,8 @@
<head>
<title>Leaflet debug page</title>
- <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7/leaflet.css" />
- <script src="http://cdn.leafletjs.com/leaflet-0.7/leaflet.js"></script>
+ <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet/v1.0.0-beta.2/leaflet.css" />
+ <script src="http://cdn.leafletjs.com/leaflet/v1.0.0-beta.2/leaflet.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="screen.css" />
diff --git a/example/marker-clustering-zoomtoshowlayer.html b/example/marker-clustering-zoomtoshowlayer.html
index 86a28d1..92cd659 100644
--- a/example/marker-clustering-zoomtoshowlayer.html
+++ b/example/marker-clustering-zoomtoshowlayer.html
@@ -3,8 +3,8 @@
<head>
<title>Leaflet debug page</title>
- <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7/leaflet.css" />
- <script src="http://cdn.leafletjs.com/leaflet-0.7/leaflet.js"></script>
+ <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet/v1.0.0-beta.2/leaflet.css" />
+ <script src="http://cdn.leafletjs.com/leaflet/v1.0.0-beta.2/leaflet.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="screen.css" />
diff --git a/example/marker-clustering.html b/example/marker-clustering.html
index 3ea2e1a..b7faac5 100644
--- a/example/marker-clustering.html
+++ b/example/marker-clustering.html
@@ -3,8 +3,8 @@
<head>
<title>Leaflet debug page</title>
- <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7/leaflet.css" />
- <script src="http://cdn.leafletjs.com/leaflet-0.7/leaflet.js"></script>
+ <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet/v1.0.0-beta.2/leaflet.css" />
+ <script src="http://cdn.leafletjs.com/leaflet/v1.0.0-beta.2/leaflet.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="screen.css" />
diff --git a/example/old-bugs/add-1000-after.html b/example/old-bugs/add-1000-after.html
index 72b1435..bae5963 100644
--- a/example/old-bugs/add-1000-after.html
+++ b/example/old-bugs/add-1000-after.html
@@ -3,7 +3,7 @@
<head>
<title>Leaflet debug page</title>
- <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7/leaflet.css" />
+ <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet/v1.0.0-beta.2/leaflet.css" />
<script src="http://cdn.leafletjs.com/leaflet-0.7/leaflet-src.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="../screen.css" />
diff --git a/example/old-bugs/add-markers-offscreen.html b/example/old-bugs/add-markers-offscreen.html
index eb4ffeb..93b37d8 100644
--- a/example/old-bugs/add-markers-offscreen.html
+++ b/example/old-bugs/add-markers-offscreen.html
@@ -3,7 +3,7 @@
<head>
<title>Leaflet debug page</title>
- <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7/leaflet.css" />
+ <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet/v1.0.0-beta.2/leaflet.css" />
<script src="http://cdn.leafletjs.com/leaflet-0.7/leaflet-src.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="../screen.css" />
diff --git a/example/old-bugs/add-remove-before-addtomap.html b/example/old-bugs/add-remove-before-addtomap.html
index 36d6d18..1ec7845 100644
--- a/example/old-bugs/add-remove-before-addtomap.html
+++ b/example/old-bugs/add-remove-before-addtomap.html
@@ -3,7 +3,7 @@
<head>
<title>Leaflet debug page</title>
- <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7/leaflet.css" />
+ <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet/v1.0.0-beta.2/leaflet.css" />
<script src="http://cdn.leafletjs.com/leaflet-0.7/leaflet-src.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="../screen.css" />
diff --git a/example/old-bugs/animationless-zoom.html b/example/old-bugs/animationless-zoom.html
index 9d71b87..d5ae02d 100644
--- a/example/old-bugs/animationless-zoom.html
+++ b/example/old-bugs/animationless-zoom.html
@@ -3,7 +3,7 @@
<head>
<title>Leaflet debug page</title>
- <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7/leaflet.css" />
+ <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet/v1.0.0-beta.2/leaflet.css" />
<script src="http://cdn.leafletjs.com/leaflet-0.7/leaflet-src.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="../screen.css" />
diff --git a/example/old-bugs/click-cluster-at-screen-edge.html b/example/old-bugs/click-cluster-at-screen-edge.html
index 5d1ad33..a4b5b1c 100644
--- a/example/old-bugs/click-cluster-at-screen-edge.html
+++ b/example/old-bugs/click-cluster-at-screen-edge.html
@@ -3,7 +3,7 @@
<head>
<title>Leaflet debug page</title>
- <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7/leaflet.css" />
+ <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet/v1.0.0-beta.2/leaflet.css" />
<script src="http://cdn.leafletjs.com/leaflet-0.7/leaflet-src.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="../screen.css" />
diff --git a/example/old-bugs/disappearing-marker-from-spider.html b/example/old-bugs/disappearing-marker-from-spider.html
index 3d3c25d..0fbd107 100644
--- a/example/old-bugs/disappearing-marker-from-spider.html
+++ b/example/old-bugs/disappearing-marker-from-spider.html
@@ -3,8 +3,8 @@
<head>
<title>Leaflet debug page</title>
- <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7/leaflet.css" />
- <script src="http://cdn.leafletjs.com/leaflet-0.7/leaflet.js"></script>
+ <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet/v1.0.0-beta.2/leaflet.css" />
+ <script src="http://cdn.leafletjs.com/leaflet/v1.0.0-beta.2/leaflet.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="../screen.css" />
diff --git a/example/old-bugs/doesnt-update-cluster-on-bottom-level.html b/example/old-bugs/doesnt-update-cluster-on-bottom-level.html
index 510d7b2..830bff7 100644
--- a/example/old-bugs/doesnt-update-cluster-on-bottom-level.html
+++ b/example/old-bugs/doesnt-update-cluster-on-bottom-level.html
@@ -3,7 +3,7 @@
<head>
<title>Leaflet debug page</title>
- <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7/leaflet.css" />
+ <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet/v1.0.0-beta.2/leaflet.css" />
<script src="http://cdn.leafletjs.com/leaflet-0.7/leaflet-src.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="../screen.css" />
diff --git a/example/old-bugs/remove-add-clustering.html b/example/old-bugs/remove-add-clustering.html
index 60ebfa1..9470c1d 100644
--- a/example/old-bugs/remove-add-clustering.html
+++ b/example/old-bugs/remove-add-clustering.html
@@ -3,7 +3,7 @@
<head>
<title>Leaflet debug page</title>
- <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7/leaflet.css" />
+ <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet/v1.0.0-beta.2/leaflet.css" />
<script src="http://cdn.leafletjs.com/leaflet-0.7/leaflet-src.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="../screen.css" />
diff --git a/example/old-bugs/remove-when-spiderfied.html b/example/old-bugs/remove-when-spiderfied.html
index eb14f55..8b62c86 100644
--- a/example/old-bugs/remove-when-spiderfied.html
+++ b/example/old-bugs/remove-when-spiderfied.html
@@ -3,7 +3,7 @@
<head>
<title>Leaflet debug page</title>
- <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7/leaflet.css" />
+ <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet/v1.0.0-beta.2/leaflet.css" />
<script src="http://cdn.leafletjs.com/leaflet-0.7/leaflet-src.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="../screen.css" />
diff --git a/example/old-bugs/removelayer-after-remove-from-map.html b/example/old-bugs/removelayer-after-remove-from-map.html
index 48b5de4..bc4f0e1 100644
--- a/example/old-bugs/removelayer-after-remove-from-map.html
+++ b/example/old-bugs/removelayer-after-remove-from-map.html
@@ -3,7 +3,7 @@
<head>
<title>Leaflet debug page</title>
- <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7/leaflet.css" />
+ <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet/v1.0.0-beta.2/leaflet.css" />
<script src="http://cdn.leafletjs.com/leaflet-0.7/leaflet-src.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="../screen.css" />
diff --git a/example/old-bugs/setView-doesnt-remove.html b/example/old-bugs/setView-doesnt-remove.html
index 05693b9..72fa220 100644
--- a/example/old-bugs/setView-doesnt-remove.html
+++ b/example/old-bugs/setView-doesnt-remove.html
@@ -3,7 +3,7 @@
<head>
<title>Leaflet debug page</title>
- <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7/leaflet.css" />
+ <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet/v1.0.0-beta.2/leaflet.css" />
<script src="http://cdn.leafletjs.com/leaflet-0.7/leaflet-src.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="../screen.css" />
diff --git a/example/old-bugs/zoomtoshowlayer-doesnt-need-to-zoom.html b/example/old-bugs/zoomtoshowlayer-doesnt-need-to-zoom.html
index 4a3d69d..553f106 100644
--- a/example/old-bugs/zoomtoshowlayer-doesnt-need-to-zoom.html
+++ b/example/old-bugs/zoomtoshowlayer-doesnt-need-to-zoom.html
@@ -3,7 +3,7 @@
<head>
<title>Leaflet debug page</title>
- <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7/leaflet.css" />
+ <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet/v1.0.0-beta.2/leaflet.css" />
<script src="http://cdn.leafletjs.com/leaflet-0.7/leaflet-src.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="../screen.css" />
diff --git a/example/old-bugs/zoomtoshowlayer-doesnt-zoom-if-centered-on.html b/example/old-bugs/zoomtoshowlayer-doesnt-zoom-if-centered-on.html
index 33c1e18..5341e59 100644
--- a/example/old-bugs/zoomtoshowlayer-doesnt-zoom-if-centered-on.html
+++ b/example/old-bugs/zoomtoshowlayer-doesnt-zoom-if-centered-on.html
@@ -3,7 +3,7 @@
<head>
<title>Leaflet debug page</title>
- <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7/leaflet.css" />
+ <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet/v1.0.0-beta.2/leaflet.css" />
<script src="http://cdn.leafletjs.com/leaflet-0.7/leaflet-src.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="../screen.css" />
diff --git a/example/remove-geoJSON-when-spiderfied.html b/example/remove-geoJSON-when-spiderfied.html
index 6b23d3d..58604db 100644
--- a/example/remove-geoJSON-when-spiderfied.html
+++ b/example/remove-geoJSON-when-spiderfied.html
@@ -3,7 +3,7 @@
<head>
<title>Leaflet debug page</title>
- <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7/leaflet.css" />
+ <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet/v1.0.0-beta.2/leaflet.css" />
<script src="http://cdn.leafletjs.com/leaflet-0.7/leaflet-src.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="screen.css" />
diff --git a/spec/suites/CircleMarkerSupportSpec.js b/spec/suites/CircleMarkerSupportSpec.js
index 04b667a..1b8b48d 100644
--- a/spec/suites/CircleMarkerSupportSpec.js
+++ b/spec/suites/CircleMarkerSupportSpec.js
@@ -1,54 +1,106 @@
describe('support for CircleMarker elements', function () {
- var map, div, clock;
- beforeEach(function () {
- clock = sinon.useFakeTimers();
- div = document.createElement('div');
- div.style.width = '200px';
- div.style.height = '200px';
- document.body.appendChild(div);
+ /**
+ * Avoid as much as possible creating and destroying objects for each test.
+ * Instead, try re-using them, except for the ones under test of course.
+ * PhantomJS does not perform garbage collection for the life of the page,
+ * i.e. during the entire test process (Karma runs all tests in a single page).
+ * http://stackoverflow.com/questions/27239708/how-to-get-around-memory-error-with-karma-phantomjs
+ *
+ * The `beforeEach` and `afterEach do not seem to cause much issue.
+ * => they can still be used to initialize some setup between each test.
+ * Using them keeps a readable spec/index.
+ *
+ * But refrain from re-creating div and map every time. Re-use those objects.
+ */
+
+ /////////////////////////////
+ // SETUP FOR EACH TEST
+ /////////////////////////////
+
+ beforeEach(function () {
- map = L.map(div, { maxZoom: 18 });
+ clock = sinon.useFakeTimers();
- map.fitBounds(new L.LatLngBounds([
- [1, 1],
- [2, 2]
- ]));
});
+
afterEach(function () {
+
+ if (group instanceof L.MarkerClusterGroup) {
+ group.removeLayers(group.getLayers());
+ map.removeLayer(group);
+ }
+
+ // group must be thrown away since we are testing it with a potentially
+ // different configuration at each test.
+ group = null;
+
clock.restore();
- document.body.removeChild(div);
+ clock = null;
+
});
+
+ /////////////////////////////
+ // PREPARATION CODE
+ /////////////////////////////
+
+ var div, map, group, clock;
+
+ div = document.createElement('div');
+ div.style.width = '200px';
+ div.style.height = '200px';
+ document.body.appendChild(div);
+
+ map = L.map(div, { maxZoom: 18 });
+
+ // Corresponds to zoom level 8 for the above div dimensions.
+ map.fitBounds(new L.LatLngBounds([
+ [1, 1],
+ [2, 2]
+ ]));
+
+
+ /////////////////////////////
+ // TESTS
+ /////////////////////////////
+
it('appears when added to the group before the group is added to the map', function () {
- var group = new L.MarkerClusterGroup();
+ group = new L.MarkerClusterGroup();
+
var marker = new L.CircleMarker([1.5, 1.5]);
group.addLayer(marker);
map.addLayer(group);
- expect(marker._container).to.not.be(undefined);
- expect(marker._container.parentNode).to.be(map._pathRoot);
+ // Leaflet 1.0.0 now uses an intermediate L.Renderer.
+ // marker > _path > _rootGroup (g) > _container (svg) > pane (div)
+ expect(marker._path.parentNode.parentNode).to.not.be(undefined);
+ expect(marker._path.parentNode.parentNode.parentNode).to.be(map.getPane('overlayPane'));
clock.tick(1000);
});
+
it('appears when added to the group after the group is added to the map', function () {
- var group = new L.MarkerClusterGroup();
+ group = new L.MarkerClusterGroup();
+
var marker = new L.CircleMarker([1.5, 1.5]);
group.addLayer(marker);
map.addLayer(group);
- expect(marker._container).to.not.be(undefined);
- expect(marker._container.parentNode).to.be(map._pathRoot);
+ expect(marker._path.parentNode.parentNode).to.not.be(undefined);
+ expect(marker._path.parentNode.parentNode.parentNode).to.be(map.getPane('overlayPane'));
clock.tick(1000);
});
+
it('appears animated when added to the group after the group is added to the map', function () {
- var group = new L.MarkerClusterGroup({ animateAddingMarkers: true });
+ group = new L.MarkerClusterGroup({ animateAddingMarkers: true });
+
var marker = new L.CircleMarker([1.5, 1.5]);
var marker2 = new L.CircleMarker([1.5, 1.5]);
@@ -56,35 +108,37 @@
group.addLayer(marker);
group.addLayer(marker2);
- expect(marker._container.parentNode).to.be(map._pathRoot);
- expect(marker2._container.parentNode).to.be(map._pathRoot);
+ expect(marker._path.parentNode.parentNode.parentNode).to.be(map.getPane('overlayPane'));
+ expect(marker2._path.parentNode.parentNode.parentNode).to.be(map.getPane('overlayPane'));
clock.tick(1000);
- expect(marker._container.parentNode).to.be(null);
- expect(marker2._container.parentNode).to.be(null);
+ expect(marker._path.parentNode).to.be(null);
+ expect(marker2._path.parentNode).to.be(null);
});
-
it('creates a cluster when 2 overlapping markers are added before the group is added to the map', function () {
- var group = new L.MarkerClusterGroup();
+ group = new L.MarkerClusterGroup();
+
var marker = new L.CircleMarker([1.5, 1.5]);
var marker2 = new L.CircleMarker([1.5, 1.5]);
group.addLayers([marker, marker2]);
map.addLayer(group);
- expect(marker._container).to.be(undefined);
- expect(marker2._container).to.be(undefined);
+ expect(marker._path).to.be(undefined);
+ expect(marker2._path).to.be(undefined);
expect(map._panes.markerPane.childNodes.length).to.be(1);
clock.tick(1000);
});
+
it('creates a cluster when 2 overlapping markers are added after the group is added to the map', function () {
- var group = new L.MarkerClusterGroup();
+ group = new L.MarkerClusterGroup();
+
var marker = new L.CircleMarker([1.5, 1.5]);
var marker2 = new L.CircleMarker([1.5, 1.5]);
@@ -92,8 +146,8 @@
group.addLayer(marker);
group.addLayer(marker2);
- expect(marker._container.parentNode).to.be(null); //Removed then re-added, so null
- expect(marker2._container).to.be(undefined);
+ expect(marker._path.parentNode).to.be(null); //Removed then re-added, so null
+ expect(marker2._path).to.be(undefined);
expect(map._panes.markerPane.childNodes.length).to.be(1);
@@ -102,20 +156,29 @@
it('disappears when removed from the group', function () {
- var group = new L.MarkerClusterGroup();
+ group = new L.MarkerClusterGroup();
+
var marker = new L.CircleMarker([1.5, 1.5]);
group.addLayer(marker);
map.addLayer(group);
- expect(marker._container).to.not.be(undefined);
- expect(marker._container.parentNode).to.be(map._pathRoot);
+ expect(marker._path.parentNode).to.not.be(undefined);
+ expect(marker._path.parentNode.parentNode.parentNode).to.be(map.getPane('overlayPane'));
group.removeLayer(marker);
- expect(marker._container.parentNode).to.be(null);
+ expect(marker._path.parentNode).to.be(null);
clock.tick(1000);
});
+
+ /////////////////////////////
+ // CLEAN UP CODE
+ /////////////////////////////
+
+ map.remove();
+ document.body.removeChild(div);
+
});
\ No newline at end of file
diff --git a/spec/suites/CircleSupportSpec.js b/spec/suites/CircleSupportSpec.js
index 245951a..552df23 100644
--- a/spec/suites/CircleSupportSpec.js
+++ b/spec/suites/CircleSupportSpec.js
@@ -1,54 +1,106 @@
describe('support for Circle elements', function () {
- var map, div, clock;
- beforeEach(function () {
- clock = sinon.useFakeTimers();
- div = document.createElement('div');
- div.style.width = '200px';
- div.style.height = '200px';
- document.body.appendChild(div);
+ /**
+ * Avoid as much as possible creating and destroying objects for each test.
+ * Instead, try re-using them, except for the ones under test of course.
+ * PhantomJS does not perform garbage collection for the life of the page,
+ * i.e. during the entire test process (Karma runs all tests in a single page).
+ * http://stackoverflow.com/questions/27239708/how-to-get-around-memory-error-with-karma-phantomjs
+ *
+ * The `beforeEach` and `afterEach do not seem to cause much issue.
+ * => they can still be used to initialize some setup between each test.
+ * Using them keeps a readable spec/index.
+ *
+ * But refrain from re-creating div and map every time. Re-use those objects.
+ */
+
+ /////////////////////////////
+ // SETUP FOR EACH TEST
+ /////////////////////////////
+
+ beforeEach(function () {
- map = L.map(div, { maxZoom: 18 });
+ clock = sinon.useFakeTimers();
- map.fitBounds(new L.LatLngBounds([
- [1, 1],
- [2, 2]
- ]));
});
+
afterEach(function () {
+
+ if (group instanceof L.MarkerClusterGroup) {
+ group.removeLayers(group.getLayers());
+ map.removeLayer(group);
+ }
+
+ // group must be thrown away since we are testing it with a potentially
+ // different configuration at each test.
+ group = null;
+
clock.restore();
- document.body.removeChild(div);
+ clock = null;
+
});
+
+ /////////////////////////////
+ // PREPARATION CODE
+ /////////////////////////////
+
+ var div, map, group, clock;
+
+ div = document.createElement('div');
+ div.style.width = '200px';
+ div.style.height = '200px';
+ document.body.appendChild(div);
+
+ map = L.map(div, { maxZoom: 18 });
+
+ // Corresponds to zoom level 8 for the above div dimensions.
+ map.fitBounds(new L.LatLngBounds([
+ [1, 1],
+ [2, 2]
+ ]));
+
+
+ /////////////////////////////
+ // TESTS
+ /////////////////////////////
+
it('appears when added to the group before the group is added to the map', function () {
- var group = new L.MarkerClusterGroup();
+ group = new L.MarkerClusterGroup();
+
var marker = new L.Circle([1.5, 1.5], 200);
group.addLayer(marker);
map.addLayer(group);
- expect(marker._container).to.not.be(undefined);
- expect(marker._container.parentNode).to.be(map._pathRoot);
+ // Leaflet 1.0.0 now uses an intermediate L.Renderer.
+ // marker > _path > _rootGroup (g) > _container (svg) > pane (div)
+ expect(marker._path.parentNode).to.not.be(undefined);
+ expect(marker._path.parentNode.parentNode.parentNode).to.be(map.getPane('overlayPane'));
clock.tick(1000);
});
+
it('appears when added to the group after the group is added to the map', function () {
- var group = new L.MarkerClusterGroup();
+ group = new L.MarkerClusterGroup();
+
var marker = new L.Circle([1.5, 1.5], 200);
group.addLayer(marker);
map.addLayer(group);
- expect(marker._container).to.not.be(undefined);
- expect(marker._container.parentNode).to.be(map._pathRoot);
+ expect(marker._path.parentNode).to.not.be(undefined);
+ expect(marker._path.parentNode.parentNode.parentNode).to.be(map.getPane('overlayPane'));
clock.tick(1000);
});
+
it('appears animated when added to the group after the group is added to the map', function () {
- var group = new L.MarkerClusterGroup({ animateAddingMarkers: true });
+ group = new L.MarkerClusterGroup({ animateAddingMarkers: true });
+
var marker = new L.Circle([1.5, 1.5], 200);
var marker2 = new L.Circle([1.5, 1.5], 200);
@@ -56,32 +108,34 @@
group.addLayer(marker);
group.addLayer(marker2);
- expect(marker._container.parentNode).to.be(map._pathRoot);
- expect(marker2._container.parentNode).to.be(map._pathRoot);
+ expect(marker._path.parentNode.parentNode.parentNode).to.be(map.getPane('overlayPane'));
+ expect(marker2._path.parentNode.parentNode.parentNode).to.be(map.getPane('overlayPane'));
clock.tick(1000);
});
-
it('creates a cluster when 2 overlapping markers are added before the group is added to the map', function () {
- var group = new L.MarkerClusterGroup();
+ group = new L.MarkerClusterGroup();
+
var marker = new L.Circle([1.5, 1.5], 200);
var marker2 = new L.Circle([1.5, 1.5], 200);
group.addLayers([marker, marker2]);
map.addLayer(group);
- expect(marker._container).to.be(undefined);
- expect(marker2._container).to.be(undefined);
+ expect(marker._path).to.be(undefined);
+ expect(marker2._path).to.be(undefined);
expect(map._panes.markerPane.childNodes.length).to.be(1);
clock.tick(1000);
});
+
it('creates a cluster when 2 overlapping markers are added after the group is added to the map', function () {
- var group = new L.MarkerClusterGroup();
+ group = new L.MarkerClusterGroup();
+
var marker = new L.Circle([1.5, 1.5], 200);
var marker2 = new L.Circle([1.5, 1.5], 200);
@@ -89,8 +143,8 @@
group.addLayer(marker);
group.addLayer(marker2);
- expect(marker._container.parentNode).to.be(null); //Removed then re-added, so null
- expect(marker2._container).to.be(undefined);
+ expect(marker._path.parentNode).to.be(null); //Removed then re-added, so null
+ expect(marker2._path).to.be(undefined);
expect(map._panes.markerPane.childNodes.length).to.be(1);
@@ -99,20 +153,29 @@
it('disappears when removed from the group', function () {
- var group = new L.MarkerClusterGroup();
+ group = new L.MarkerClusterGroup();
+
var marker = new L.Circle([1.5, 1.5], 200);
group.addLayer(marker);
map.addLayer(group);
- expect(marker._container).to.not.be(undefined);
- expect(marker._container.parentNode).to.be(map._pathRoot);
+ expect(marker._path.parentNode).to.not.be(undefined);
+ expect(marker._path.parentNode.parentNode.parentNode).to.be(map.getPane('overlayPane'));
group.removeLayer(marker);
- expect(marker._container.parentNode).to.be(null);
+ expect(marker._path.parentNode).to.be(null);
clock.tick(1000);
});
+
+ /////////////////////////////
+ // CLEAN UP CODE
+ /////////////////////////////
+
+ map.remove();
+ document.body.removeChild(div);
+
});
\ No newline at end of file
diff --git a/spec/suites/NonPointSpec.js b/spec/suites/NonPointSpec.js
index 561167e..548bd6a 100644
--- a/spec/suites/NonPointSpec.js
+++ b/spec/suites/NonPointSpec.js
@@ -1,63 +1,115 @@
describe('adding non point data works', function () {
- var map, div;
+
+ /**
+ * Avoid as much as possible creating and destroying objects for each test.
+ * Instead, try re-using them, except for the ones under test of course.
+ * PhantomJS does not perform garbage collection for the life of the page,
+ * i.e. during the entire test process (Karma runs all tests in a single page).
+ * http://stackoverflow.com/questions/27239708/how-to-get-around-memory-error-with-karma-phantomjs
+ *
+ * The `beforeEach` and `afterEach do not seem to cause much issue.
+ * => they can still be used to initialize some setup between each test.
+ * Using them keeps a readable spec/index.
+ *
+ * But refrain from re-creating div and map every time. Re-use those objects.
+ */
+
+ /////////////////////////////
+ // SETUP FOR EACH TEST
+ /////////////////////////////
+
beforeEach(function () {
- div = document.createElement('div');
- div.style.width = '200px';
- div.style.height = '200px';
- document.body.appendChild(div);
- map = L.map(div, { maxZoom: 18 });
+ // Nothing for this test suite.
- map.fitBounds(new L.LatLngBounds([
- [1, 1],
- [2, 2]
- ]));
});
+
afterEach(function () {
- document.body.removeChild(div);
+
+ if (group instanceof L.MarkerClusterGroup) {
+ group.removeLayers(group.getLayers());
+ map.removeLayer(group);
+ }
+
+ // group must be thrown away since we are testing it with a potentially
+ // different configuration at each test.
+ group = null;
+
});
+
+ /////////////////////////////
+ // PREPARATION CODE
+ /////////////////////////////
+
+ var div, map, group;
+
+ div = document.createElement('div');
+ div.style.width = '200px';
+ div.style.height = '200px';
+ document.body.appendChild(div);
+
+ map = L.map(div, { maxZoom: 18 });
+
+ // Corresponds to zoom level 8 for the above div dimensions.
+ map.fitBounds(new L.LatLngBounds([
+ [1, 1],
+ [2, 2]
+ ]));
+
+
+ /////////////////////////////
+ // TESTS
+ /////////////////////////////
+
it('Allows adding a polygon before via addLayer', function () {
- var group = new L.MarkerClusterGroup();
+ group = new L.MarkerClusterGroup();
+
var polygon = new L.Polygon([[1.5, 1.5], [2.0, 1.5], [2.0,2.0], [1.5, 2.0]]);
group.addLayer(polygon);
map.addLayer(group);
- expect(polygon._container).to.not.be(undefined);
- expect(polygon._container.parentNode).to.be(map._pathRoot);
+ // Leaflet 1.0.0 now uses an intermediate L.Renderer.
+ // polygon > _path > _rootGroup (g) > _container (svg) > pane (div)
+ expect(polygon._path).to.not.be(undefined);
+ expect(polygon._path.parentNode.parentNode.parentNode).to.be(map.getPane('overlayPane'));
expect(group.hasLayer(polygon));
});
it('Allows adding a polygon before via addLayers([])', function () {
- var group = new L.MarkerClusterGroup();
+ group = new L.MarkerClusterGroup();
+
var polygon = new L.Polygon([[1.5, 1.5], [2.0, 1.5], [2.0, 2.0], [1.5, 2.0]]);
group.addLayers([polygon]);
map.addLayer(group);
- expect(polygon._container).to.not.be(undefined);
- expect(polygon._container.parentNode).to.be(map._pathRoot);
+ expect(polygon._path).to.not.be(undefined);
+ expect(polygon._path.parentNode.parentNode.parentNode).to.be(map.getPane('overlayPane'));
});
it('Removes polygons from map when removed', function () {
- var group = new L.MarkerClusterGroup();
+ group = new L.MarkerClusterGroup();
+
var polygon = new L.Polygon([[1.5, 1.5], [2.0, 1.5], [2.0, 2.0], [1.5, 2.0]]);
group.addLayer(polygon);
map.addLayer(group);
map.removeLayer(group);
- expect(polygon._container.parentNode).to.be(null);
+ expect(polygon._path.parentNode).to.be(null);
});
describe('hasLayer', function () {
+
it('returns false when not added', function () {
- var group = new L.MarkerClusterGroup();
+ group = new L.MarkerClusterGroup();
+
var polygon = new L.Polygon([[1.5, 1.5], [2.0, 1.5], [2.0, 2.0], [1.5, 2.0]]);
expect(group.hasLayer(polygon)).to.be(false);
@@ -72,7 +124,8 @@
});
it('returns true before adding to map', function() {
- var group = new L.MarkerClusterGroup();
+ group = new L.MarkerClusterGroup();
+
var polygon = new L.Polygon([[1.5, 1.5], [2.0, 1.5], [2.0, 2.0], [1.5, 2.0]]);
group.addLayers([polygon]);
@@ -81,7 +134,8 @@
});
it('returns true after adding to map after adding polygon', function () {
- var group = new L.MarkerClusterGroup();
+ group = new L.MarkerClusterGroup();
+
var polygon = new L.Polygon([[1.5, 1.5], [2.0, 1.5], [2.0, 2.0], [1.5, 2.0]]);
group.addLayer(polygon);
@@ -91,7 +145,8 @@
});
it('returns true after adding to map before adding polygon', function () {
- var group = new L.MarkerClusterGroup();
+ group = new L.MarkerClusterGroup();
+
var polygon = new L.Polygon([[1.5, 1.5], [2.0, 1.5], [2.0, 2.0], [1.5, 2.0]]);
map.addLayer(group);
@@ -99,11 +154,14 @@
expect(group.hasLayer(polygon)).to.be(true);
});
+
});
describe('removeLayer', function() {
+
it('removes before adding to map', function () {
- var group = new L.MarkerClusterGroup();
+ group = new L.MarkerClusterGroup();
+
var polygon = new L.Polygon([[1.5, 1.5], [2.0, 1.5], [2.0, 2.0], [1.5, 2.0]]);
group.addLayer(polygon);
@@ -114,7 +172,8 @@
});
it('removes before adding to map', function () {
- var group = new L.MarkerClusterGroup();
+ group = new L.MarkerClusterGroup();
+
var polygon = new L.Polygon([[1.5, 1.5], [2.0, 1.5], [2.0, 2.0], [1.5, 2.0]]);
group.addLayers([polygon]);
@@ -125,7 +184,8 @@
});
it('removes after adding to map after adding polygon', function () {
- var group = new L.MarkerClusterGroup();
+ group = new L.MarkerClusterGroup();
+
var polygon = new L.Polygon([[1.5, 1.5], [2.0, 1.5], [2.0, 2.0], [1.5, 2.0]]);
group.addLayer(polygon);
@@ -137,7 +197,8 @@
});
it('removes after adding to map before adding polygon', function () {
- var group = new L.MarkerClusterGroup();
+ group = new L.MarkerClusterGroup();
+
var polygon = new L.Polygon([[1.5, 1.5], [2.0, 1.5], [2.0, 2.0], [1.5, 2.0]]);
map.addLayer(group);
@@ -147,11 +208,14 @@
group.removeLayer(polygon);
expect(group.hasLayer(polygon)).to.be(false);
});
+
});
describe('removeLayers', function () {
+
it('removes before adding to map', function () {
- var group = new L.MarkerClusterGroup();
+ group = new L.MarkerClusterGroup();
+
var polygon = new L.Polygon([[1.5, 1.5], [2.0, 1.5], [2.0, 2.0], [1.5, 2.0]]);
group.addLayer(polygon);
@@ -162,7 +226,8 @@
});
it('removes before adding to map', function () {
- var group = new L.MarkerClusterGroup();
+ group = new L.MarkerClusterGroup();
+
var polygon = new L.Polygon([[1.5, 1.5], [2.0, 1.5], [2.0, 2.0], [1.5, 2.0]]);
group.addLayers([polygon]);
@@ -173,7 +238,8 @@
});
it('removes after adding to map after adding polygon', function () {
- var group = new L.MarkerClusterGroup();
+ group = new L.MarkerClusterGroup();
+
var polygon = new L.Polygon([[1.5, 1.5], [2.0, 1.5], [2.0, 2.0], [1.5, 2.0]]);
group.addLayer(polygon);
@@ -185,7 +251,8 @@
});
it('removes after adding to map before adding polygon', function () {
- var group = new L.MarkerClusterGroup();
+ group = new L.MarkerClusterGroup();
+
var polygon = new L.Polygon([[1.5, 1.5], [2.0, 1.5], [2.0, 2.0], [1.5, 2.0]]);
map.addLayer(group);
@@ -195,5 +262,15 @@
group.removeLayers([polygon]);
expect(group.hasLayer(polygon)).to.be(false);
});
+
});
+
+
+ /////////////////////////////
+ // CLEAN UP CODE
+ /////////////////////////////
+
+ map.remove();
+ document.body.removeChild(div);
+
});
\ No newline at end of file
diff --git a/spec/suites/RememberOpacity.js b/spec/suites/RememberOpacity.js
index bb023a5..4978f04 100644
--- a/spec/suites/RememberOpacity.js
+++ b/spec/suites/RememberOpacity.js
@@ -27,7 +27,7 @@ describe('Remember opacity', function () {
map = L.map(div, { maxZoom: 18 });
markers = [];
- for (var i=0; i<markerDefs.length; i++) {
+ for (var i = 0; i < markerDefs.length; i++) {
markers.push( L.marker(markerDefs[i].latLng, markerDefs[i].opts ) );
}
});
diff --git a/spec/suites/eventsSpec.js b/spec/suites/eventsSpec.js
index 38599b8..e2a64dd 100644
--- a/spec/suites/eventsSpec.js
+++ b/spec/suites/eventsSpec.js
@@ -1,25 +1,71 @@
describe('events', function() {
- var map, div;
- beforeEach(function() {
- div = document.createElement('div');
- div.style.width = '200px';
- div.style.height = '200px';
- document.body.appendChild(div);
-
- map = L.map(div, { maxZoom: 18 });
-
- map.fitBounds(new L.LatLngBounds([
- [1, 1],
- [2, 2]
- ]));
+
+ /**
+ * Avoid as much as possible creating and destroying objects for each test.
+ * Instead, try re-using them, except for the ones under test of course.
+ * PhantomJS does not perform garbage collection for the life of the page,
+ * i.e. during the entire test process (Karma runs all tests in a single page).
+ * http://stackoverflow.com/questions/27239708/how-to-get-around-memory-error-with-karma-phantomjs
+ *
+ * The `beforeEach` and `afterEach do not seem to cause much issue.
+ * => they can still be used to initialize some setup between each test.
+ * Using them keeps a readable spec/index.
+ *
+ * But refrain from re-creating div and map every time. Re-use those objects.
+ */
+
+ /////////////////////////////
+ // SETUP FOR EACH TEST
+ /////////////////////////////
+
+ beforeEach(function () {
+
+ //
+
});
- afterEach(function() {
- document.body.removeChild(div);
+
+ afterEach(function () {
+
+ if (group instanceof L.MarkerClusterGroup) {
+ group.removeLayers(group.getLayers());
+ map.removeLayer(group);
+ }
+
+ // group must be thrown away since we are testing it with a potentially
+ // different configuration at each test.
+ group = null;
+
});
+
+ /////////////////////////////
+ // PREPARATION CODE
+ /////////////////////////////
+
+ var div, map, group;
+
+ div = document.createElement('div');
+ div.style.width = '200px';
+ div.style.height = '200px';
+ document.body.appendChild(div);
+
+ map = L.map(div, { maxZoom: 18 });
+
+ // Corresponds to zoom level 8 for the above div dimensions.
+ map.fitBounds(new L.LatLngBounds([
+ [1, 1],
+ [2, 2]
+ ]));
+
+
+ /////////////////////////////
+ // TESTS
+ /////////////////////////////
+
it('is fired for a single child marker', function () {
var callback = sinon.spy();
- var group = new L.MarkerClusterGroup();
+
+ group = new L.MarkerClusterGroup();
var marker = new L.Marker([1.5, 1.5]);
@@ -27,14 +73,16 @@
group.addLayer(marker);
map.addLayer(group);
- marker.fire('click');
+ // In Leaflet 1.0.0, event propagation must be explicitly set by 3rd argument.
+ marker.fire('click', null, true);
expect(callback.called).to.be(true);
});
it('is fired for a child polygon', function () {
var callback = sinon.spy();
- var group = new L.MarkerClusterGroup();
+
+ group = new L.MarkerClusterGroup();
var polygon = new L.Polygon([[1.5, 1.5], [2.0, 1.5], [2.0, 2.0], [1.5, 2.0]]);
@@ -42,14 +90,15 @@
group.addLayer(polygon);
map.addLayer(group);
- polygon.fire('click');
+ polygon.fire('click', null, true);
expect(callback.called).to.be(true);
});
it('is fired for a cluster click', function () {
var callback = sinon.spy();
- var group = new L.MarkerClusterGroup();
+
+ group = new L.MarkerClusterGroup();
var marker = new L.Marker([1.5, 1.5]);
var marker2 = new L.Marker([1.5, 1.5]);
@@ -61,15 +110,17 @@
var cluster = group.getVisibleParent(marker);
expect(cluster instanceof L.MarkerCluster).to.be(true);
- cluster.fire('click');
+ cluster.fire('click', null, true);
expect(callback.called).to.be(true);
});
describe('after being added, removed, re-added from the map', function() {
+
it('still fires events for nonpoint data', function() {
var callback = sinon.spy();
- var group = new L.MarkerClusterGroup();
+
+ group = new L.MarkerClusterGroup();
var polygon = new L.Polygon([[1.5, 1.5], [2.0, 1.5], [2.0, 2.0], [1.5, 2.0]]);
@@ -79,14 +130,15 @@
map.removeLayer(group);
map.addLayer(group);
- polygon.fire('click');
+ polygon.fire('click', null, true);
expect(callback.called).to.be(true);
});
it('still fires events for point data', function() {
var callback = sinon.spy();
- var group = new L.MarkerClusterGroup();
+
+ group = new L.MarkerClusterGroup();
var marker = new L.Marker([1.5, 1.5]);
@@ -96,14 +148,15 @@
map.removeLayer(group);
map.addLayer(group);
- marker.fire('click');
+ marker.fire('click', null, true);
expect(callback.called).to.be(true);
});
it('still fires cluster events', function() {
var callback = sinon.spy();
- var group = new L.MarkerClusterGroup();
+
+ group = new L.MarkerClusterGroup();
var marker = new L.Marker([1.5, 1.5]);
var marker2 = new L.Marker([1.5, 1.5]);
@@ -118,14 +171,15 @@
var cluster = group.getVisibleParent(marker);
expect(cluster instanceof L.MarkerCluster).to.be(true);
- cluster.fire('click');
+ cluster.fire('click', null, true);
expect(callback.called).to.be(true);
});
- it('doesnt break map events', function () {
+ it('does not break map events', function () {
var callback = sinon.spy();
- var group = new L.MarkerClusterGroup();
+
+ group = new L.MarkerClusterGroup();
map.on('zoomend', callback);
map.addLayer(group);
@@ -138,11 +192,13 @@
expect(callback.called).to.be(true);
});
});
+
/*
//No normal events can be fired by a clustered marker, so probably don't need this.
it('is fired for a clustered child marker', function() {
var callback = sinon.spy();
- var group = new L.MarkerClusterGroup();
+
+ group = new L.MarkerClusterGroup();
var marker = new L.Marker([1.5, 1.5]);
var marker2 = new L.Marker([1.5, 1.5]);
@@ -156,4 +212,12 @@
expect(callback.called).to.be(true);
});
*/
+
+
+ /////////////////////////////
+ // CLEAN UP CODE
+ /////////////////////////////
+
+ map.remove();
+ document.body.removeChild(div);
});
\ No newline at end of file
diff --git a/spec/suites/removeOutsideVisibleBoundsSpec.js b/spec/suites/removeOutsideVisibleBoundsSpec.js
index a9ce90f..0e92133 100644
--- a/spec/suites/removeOutsideVisibleBoundsSpec.js
+++ b/spec/suites/removeOutsideVisibleBoundsSpec.js
@@ -21,6 +21,7 @@ describe('Option removeOutsideVisibleBounds', function () {
beforeEach(function () {
// Nothing for this test suite.
+ clock = sinon.useFakeTimers();
});
@@ -30,7 +31,8 @@ describe('Option removeOutsideVisibleBounds', function () {
L.Browser.mobile = previousMobileSetting;
if (group instanceof L.MarkerClusterGroup) {
- group.removeLayers(group.getLayers());
+ //group.removeLayers(group.getLayers());
+ group.clearLayers();
map.removeLayer(group);
}
@@ -38,6 +40,9 @@ describe('Option removeOutsideVisibleBounds', function () {
// different configuration at each test.
group = null;
+ clock.restore();
+ clock = null;
+
});
@@ -52,7 +57,7 @@ describe('Option removeOutsideVisibleBounds', function () {
marker5 = L.marker([1.5, 3.4]), // 2 screens width away.
markers = [marker1, marker2, marker3, marker4, marker5],
previousMobileSetting = L.Browser.mobile,
- div, map, group, i;
+ div, map, group, i, clock;
div = document.createElement('div');
div.style.width = '200px';
@@ -131,7 +136,7 @@ describe('Option removeOutsideVisibleBounds', function () {
// Following tests need markers at very high latitude.
// They test the _checkBoundsMaxLat method against the default Web/Spherical Mercator projection maximum latitude (85.0511287798).
// The actual map view should be '-1.0986328125,84.92929204957956,1.0986328125,85.11983467698401'
- // The expdanded bounds without correction should be '-3.2958984375,84.7387494221751,3.2958984375,85.31037730438847'
+ // The expanded bounds without correction should be '-3.2958984375,84.7387494221751,3.2958984375,85.31037730438847'
var latLngsMaxLatDefault = [
[100, 3], // Impossible in real world, but nothing prevents the user from entering such latitude, and Web/Spherical Mercator projection will still display it at 85.0511287798
[85.2, 1.5], // 1 "screen" heights away.
@@ -163,7 +168,6 @@ describe('Option removeOutsideVisibleBounds', function () {
var mapZoom = map.getZoom();
for (i = 0; i < markers.length; i++) {
- markers[i].setLatLng(latLngs[i]);
try {
expect(markers[i].__parent._zoom).to.be.below(mapZoom);
} catch (e) {
@@ -201,6 +205,8 @@ describe('Option removeOutsideVisibleBounds', function () {
checkProjection(latLngsMaxLatDefault);
+ clock.tick(1000);
+
expect(map._panes.markerPane.childNodes.length).to.be(4); // Markers 1, 2, 3 and 4.
expect(marker5._icon).to.be(null);
diff --git a/spec/suites/spiderfySpec.js b/spec/suites/spiderfySpec.js
index 366bf1a..6fdbabf 100644
--- a/spec/suites/spiderfySpec.js
+++ b/spec/suites/spiderfySpec.js
@@ -1,28 +1,74 @@
describe('spiderfy', function () {
- var map, div, clock;
- beforeEach(function () {
- clock = sinon.useFakeTimers();
- div = document.createElement('div');
- div.style.width = '200px';
- div.style.height = '200px';
- document.body.appendChild(div);
+ /**
+ * Avoid as much as possible creating and destroying objects for each test.
+ * Instead, try re-using them, except for the ones under test of course.
+ * PhantomJS does not perform garbage collection for the life of the page,
+ * i.e. during the entire test process (Karma runs all tests in a single page).
+ * http://stackoverflow.com/questions/27239708/how-to-get-around-memory-error-with-karma-phantomjs
+ *
+ * The `beforeEach` and `afterEach do not seem to cause much issue.
+ * => they can still be used to initialize some setup between each test.
+ * Using them keeps a readable spec/index.
+ *
+ * But refrain from re-creating div and map every time. Re-use those objects.
+ */
+
+ /////////////////////////////
+ // SETUP FOR EACH TEST
+ /////////////////////////////
- map = L.map(div, { maxZoom: 18 });
+ beforeEach(function () {
+
+ clock = sinon.useFakeTimers();
- map.fitBounds(new L.LatLngBounds([
- [1, 1],
- [2, 2]
- ]));
});
+
afterEach(function () {
+
+ if (group instanceof L.MarkerClusterGroup) {
+ group.removeLayers(group.getLayers());
+ map.removeLayer(group);
+ }
+
+ // group must be thrown away since we are testing it with a potentially
+ // different configuration at each test.
+ group = null;
+
clock.restore();
- document.body.removeChild(div);
+ clock = null;
+
});
+
+ /////////////////////////////
+ // PREPARATION CODE
+ /////////////////////////////
+
+ var div, map, group, clock;
+
+ div = document.createElement('div');
+ div.style.width = '200px';
+ div.style.height = '200px';
+ document.body.appendChild(div);
+
+ map = L.map(div, { maxZoom: 18 });
+
+ // Corresponds to zoom level 8 for the above div dimensions.
+ map.fitBounds(new L.LatLngBounds([
+ [1, 1],
+ [2, 2]
+ ]));
+
+
+ /////////////////////////////
+ // TESTS
+ /////////////////////////////
+
it('Spiderfies 2 Markers', function () {
- var group = new L.MarkerClusterGroup();
+ group = new L.MarkerClusterGroup();
+
var marker = new L.Marker([1.5, 1.5]);
var marker2 = new L.Marker([1.5, 1.5]);
@@ -38,7 +84,8 @@
it('Spiderfies 2 CircleMarkers', function () {
- var group = new L.MarkerClusterGroup();
+ group = new L.MarkerClusterGroup();
+
var marker = new L.CircleMarker([1.5, 1.5]);
var marker2 = new L.CircleMarker([1.5, 1.5]);
@@ -48,13 +95,16 @@
marker.__parent.spiderfy();
- expect(marker._container.parentNode).to.be(map._pathRoot);
- expect(marker2._container.parentNode).to.be(map._pathRoot);
+ // Leaflet 1.0.0 now uses an intermediate L.Renderer.
+ // marker > _path > _rootGroup (g) > _container (svg) > pane (div)
+ expect(marker._path.parentNode.parentNode.parentNode).to.be(map.getPane('overlayPane'));
+ expect(marker2._path.parentNode.parentNode.parentNode).to.be(map.getPane('overlayPane'));
});
it('Spiderfies 2 Circles', function () {
- var group = new L.MarkerClusterGroup();
+ group = new L.MarkerClusterGroup();
+
var marker = new L.Circle([1.5, 1.5], 10);
var marker2 = new L.Circle([1.5, 1.5], 10);
@@ -64,14 +114,17 @@
marker.__parent.spiderfy();
- expect(marker._container.parentNode).to.be(map._pathRoot);
- expect(marker2._container.parentNode).to.be(map._pathRoot);
+ expect(marker._path.parentNode.parentNode.parentNode).to.be(map.getPane('overlayPane'));
+ expect(marker2._path.parentNode.parentNode.parentNode).to.be(map.getPane('overlayPane'));
});
+
describe('zoomend event listener', function () {
+
it('unspiderfies correctly', function () {
- var group = new L.MarkerClusterGroup();
+ group = new L.MarkerClusterGroup();
+
var marker = new L.Circle([1.5, 1.5], 10);
var marker2 = new L.Circle([1.5, 1.5], 10);
@@ -88,5 +141,14 @@
//We should unspiderfy with no animation, so this should be null
expect(group._spiderfied).to.be(null);
});
+
});
+
+
+ /////////////////////////////
+ // CLEAN UP CODE
+ /////////////////////////////
+
+ map.remove();
+ document.body.removeChild(div);
});
\ No newline at end of file
diff --git a/src/MarkerCluster.Spiderfier.js b/src/MarkerCluster.Spiderfier.js
index 60fca8a..1717933 100644
--- a/src/MarkerCluster.Spiderfier.js
+++ b/src/MarkerCluster.Spiderfier.js
@@ -419,9 +419,12 @@ L.MarkerClusterGroup.include({
if (layer._spiderLeg) {
this._featureGroup.removeLayer(layer);
- layer.setOpacity(1);
- //Position will be fixed up immediately in _animationUnspiderfy
- layer.setZIndexOffset(0);
+ // L.Circle can be spiderfied, but only Markers have setOpacity and setZIndexOffset methods.
+ if (layer instanceof L.Marker) {
+ layer.setOpacity(1);
+ //Position will be fixed up immediately in _animationUnspiderfy
+ layer.setZIndexOffset(0);
+ }
this._map.removeLayer(layer._spiderLeg);
delete layer._spiderLeg;
diff --git a/src/MarkerClusterGroup.js b/src/MarkerClusterGroup.js
index 3c51026..3f3b155 100644
--- a/src/MarkerClusterGroup.js
+++ b/src/MarkerClusterGroup.js
@@ -1046,6 +1046,7 @@ L.MarkerClusterGroup.include({
this._map._mapPane.className += ' leaflet-cluster-anim';
this._inZoomAnimation++;
},
+
_animationZoomIn: function (previousZoomLevel, newZoomLevel) {
var bounds = this._getExpandedVisibleBounds(),
fg = this._featureGroup,
@@ -1093,13 +1094,14 @@ L.MarkerClusterGroup.include({
n.clusterShow();
}
});
- this._ignoreMove = false;
//update the positions of the just added clusters/markers
this._topClusterLevel._recursively(bounds, previousZoomLevel, newZoomLevel, function (c) {
c._recursivelyRestoreChildPositions(newZoomLevel);
});
+ this._ignoreMove = false;
+
//Remove the old clusters and close the zoom animation
this._enqueue(function () {
//update the positions of the just added clusters/markers
@@ -1120,6 +1122,7 @@ L.MarkerClusterGroup.include({
//Remove markers that were on the map before but won't be now
this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds, previousZoomLevel, this._getExpandedVisibleBounds());
},
+
_animationAddLayer: function (layer, newCluster) {
var me = this,
fg = this._featureGroup;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/leaflet-markercluster.git
More information about the Pkg-javascript-commits
mailing list