[Pkg-javascript-commits] [leaflet-markercluster] 426/479: Test for coverage polygon not being removed when we are. #245
Jonas Smedegaard
dr at jones.dk
Thu Oct 16 16:01:04 UTC 2014
This is an automated email from the git hooks/post-receive script.
js pushed a commit to branch master
in repository leaflet-markercluster.
commit db5f0d572525b7259e173467f6964c5d2d674cb8
Author: danzel <danzel at localhost.geek.nz>
Date: Mon Oct 14 13:18:42 2013 +1300
Test for coverage polygon not being removed when we are. #245
---
spec/index.html | 3 ++-
spec/suites/onRemoveSpec.js | 42 ++++++++++++++++++++++++++++++++++++++++++
2 files changed, 44 insertions(+), 1 deletion(-)
diff --git a/spec/index.html b/spec/index.html
index 519282b..d7cae1c 100644
--- a/spec/index.html
+++ b/spec/index.html
@@ -39,8 +39,9 @@
<script type="text/javascript" src="suites/CircleMarkerSupportSpec.js"></script>
<script type="text/javascript" src="suites/CircleSupportSpec.js"></script>
-
+
<script type="text/javascript" src="suites/onAddSpec.js"></script>
+ <script type="text/javascript" src="suites/onRemoveSpec.js"></script>
<script type="text/javascript" src="suites/clearLayersSpec.js"></script>
<script type="text/javascript" src="suites/eachLayerSpec.js"></script>
<script type="text/javascript" src="suites/eventsSpec.js"></script>
diff --git a/spec/suites/onRemoveSpec.js b/spec/suites/onRemoveSpec.js
new file mode 100644
index 0000000..a1dae43
--- /dev/null
+++ b/spec/suites/onRemoveSpec.js
@@ -0,0 +1,42 @@
+describe('onRemove', 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]
+ ]));
+ });
+ afterEach(function () {
+ document.body.removeChild(div);
+ });
+
+
+ it('removes the shown coverage polygon', function () {
+
+ var group = new L.MarkerClusterGroup();
+ var marker = new L.Marker([1.5, 1.5]);
+ var marker2 = new L.Marker([1.5, 1.5]);
+ var marker3 = new L.Marker([1.5, 1.5]);
+
+ group.addLayer(marker);
+ group.addLayer(marker2);
+ group.addLayer(marker3);
+
+ map.addLayer(group);
+
+ group._showCoverage({ layer: group._topClusterLevel });
+
+ expect(group._shownPolygon).to.not.be(null);
+
+ map.removeLayer(group);
+
+ expect(group._shownPolygon).to.be(null);
+ });
+});
\ No newline at end of file
--
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