/
opt
/
canhelp
/
node_modules
/
leaflet.markercluster
/
spec
/
suites
/
/opt/canhelp/node_modules/leaflet.markercluster/spec/suites
mkdir
upload
Name
Size
Mode
Actions
AddLayer.MultipleSpec.js
4738
0755
edit
dl
rm
AddLayer.SingleSpec.js
2928
0755
edit
dl
rm
AddLayersSpec.js
4534
0755
edit
dl
rm
animateOptionSpec.js
3843
0755
edit
dl
rm
ChildChangingIconSupportSpec.js
1462
0755
edit
dl
rm
CircleMarkerSupportSpec.js
3925
0755
edit
dl
rm
CircleSupportSpec.js
3792
0755
edit
dl
rm
clearLayersSpec.js
1411
0755
edit
dl
rm
disableClusteringAtZoomSpec.js
1439
0755
edit
dl
rm
DistanceGridSpec.js
1031
0755
edit
dl
rm
eachLayerSpec.js
1557
0755
edit
dl
rm
eventsSpec.js
9747
0755
edit
dl
rm
getBoundsSpec.js
3986
0755
edit
dl
rm
getLayersSpec.js
1920
0755
edit
dl
rm
getVisibleParentSpec.js
1698
0755
edit
dl
rm
LeafletSpec.js
159
0755
edit
dl
rm
markerMoveSupportSpec.js
1657
0755
edit
dl
rm
nonIntegerZoomSpec.js
1234
0755
edit
dl
rm
NonPointSpec.js
6331
0755
edit
dl
rm
onAddSpec.js
1339
0755
edit
dl
rm
onRemoveSpec.js
1117
0755
edit
dl
rm
PaneSpec.js
1570
0755
edit
dl
rm
QuickHullSpec.js
1422
0755
edit
dl
rm
RefreshSpec.js
12929
0755
edit
dl
rm
RememberOpacity.js
4170
0755
edit
dl
rm
RemoveLayerSpec.js
4975
0755
edit
dl
rm
removeLayersSpec.js
4534
0755
edit
dl
rm
removeOutsideVisibleBoundsSpec.js
7234
0755
edit
dl
rm
singleMarkerModeSpec.js
1705
0755
edit
dl
rm
SpecHelper.js
641
0755
edit
dl
rm
spiderfySpec.js
8851
0755
edit
dl
rm
supportNegativeZoomSpec.js
2374
0755
edit
dl
rm
unspiderfySpec.js
2806
0755
edit
dl
rm
zoomAnimationSpec.js
12623
0755
edit
dl
rm
Edit:
/opt/canhelp/node_modules/leaflet.markercluster/spec/suites/eventsSpec.js
(9747B)
describe('events', function() { ///////////////////////////// // SETUP FOR EACH TEST ///////////////////////////// var div, map, group; beforeEach(function () { div = document.createElement('div'); div.style.width = '200px'; div.style.height = '200px'; document.body.appendChild(div); map = L.map(div, { maxZoom: 18, trackResize: false }); // Corresponds to zoom level 8 for the above div dimensions. map.fitBounds(new L.LatLngBounds([ [1, 1], [2, 2] ])); }); afterEach(function () { if (group instanceof L.MarkerClusterGroup) { group.removeLayers(group.getLayers()); map.removeLayer(group); } map.remove(); div.remove(); div = map = group = null; }); ///////////////////////////// // TESTS ///////////////////////////// it('is fired for a single child marker', function () { var callback = sinon.spy(); group = new L.MarkerClusterGroup(); var marker = new L.Marker([1.5, 1.5]); group.on('click', callback); group.addLayer(marker); map.addLayer(group); // 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(); 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.on('click', callback); group.addLayer(polygon); map.addLayer(group); polygon.fire('click', null, true); expect(callback.called).to.be(true); }); it('is fired for a cluster click', function () { var callback = sinon.spy(); group = new L.MarkerClusterGroup(); var marker = new L.Marker([1.5, 1.5]); var marker2 = new L.Marker([1.5, 1.5]); group.on('clusterclick', callback); group.addLayers([marker, marker2]); map.addLayer(group); var cluster = group.getVisibleParent(marker); expect(cluster instanceof L.MarkerCluster).to.be(true); 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(); 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.on('click', callback); group.addLayer(polygon); map.addLayer(group); map.removeLayer(group); map.addLayer(group); polygon.fire('click', null, true); expect(callback.called).to.be(true); }); it('still fires events for point data', function() { var callback = sinon.spy(); group = new L.MarkerClusterGroup(); var marker = new L.Marker([1.5, 1.5]); group.on('click', callback); group.addLayer(marker); map.addLayer(group); map.removeLayer(group); map.addLayer(group); marker.fire('click', null, true); expect(callback.called).to.be(true); }); it('still fires cluster events', function() { var callback = sinon.spy(); group = new L.MarkerClusterGroup(); var marker = new L.Marker([1.5, 1.5]); var marker2 = new L.Marker([1.5, 1.5]); group.on('clusterclick', callback); group.addLayers([marker, marker2]); map.addLayer(group); map.removeLayer(group); map.addLayer(group); var cluster = group.getVisibleParent(marker); expect(cluster instanceof L.MarkerCluster).to.be(true); cluster.fire('click', null, true); expect(callback.called).to.be(true); }); it('does not break map events', function () { var callback = sinon.spy(); group = new L.MarkerClusterGroup(); map.on('zoomend', callback); map.addLayer(group); map.removeLayer(group); map.addLayer(group); map.fire('zoomend'); expect(callback.called).to.be(true); }); //layeradd it('fires layeradd when markers are added while not on the map', function() { var callback = sinon.spy(); group = new L.MarkerClusterGroup(); group.on('layeradd', callback); var marker = new L.Marker([1.5, 1.5]); group.addLayer(marker); expect(callback.callCount).to.be(1); }); it('fires layeradd when vectors are added while not on the map', function() { var callback = sinon.spy(); group = new L.MarkerClusterGroup(); group.on('layeradd', callback); var polygon = new L.Polygon([[1.5, 1.5], [2.0, 1.5], [2.0, 2.0], [1.5, 2.0]]); group.addLayer(polygon); expect(callback.callCount).to.be(1); }); it('fires layeradd when markers are added while on the map', function() { var callback = sinon.spy(); group = new L.MarkerClusterGroup(); group.on('layeradd', callback); map.addLayer(group); var marker = new L.Marker([1.5, 1.5]); group.addLayer(marker); expect(callback.callCount).to.be(1); }); it('fires layeradd when vectors are added while on the map', function() { var callback = sinon.spy(); group = new L.MarkerClusterGroup(); group.on('layeradd', callback); map.addLayer(group); var polygon = new L.Polygon([[1.5, 1.5], [2.0, 1.5], [2.0, 2.0], [1.5, 2.0]]); group.addLayer(polygon); expect(callback.callCount).to.be(1); }); it('fires layeradd when markers are added using addLayers while on the map with chunked loading', function() { var callback = sinon.spy(); group = new L.MarkerClusterGroup({ chunkedLoading: true }); group.on('layeradd', callback); map.addLayer(group); var marker = new L.Marker([1.5, 1.5]); group.addLayers([marker]); expect(callback.callCount).to.be(1); }); it('fires layeradd when vectors are added using addLayers while on the map with chunked loading', function() { var callback = sinon.spy(); group = new L.MarkerClusterGroup({ chunkedLoading: true }); group.on('layeradd', callback); map.addLayer(group); var polygon = new L.Polygon([[1.5, 1.5], [2.0, 1.5], [2.0, 2.0], [1.5, 2.0]]); group.addLayers([polygon]); expect(callback.callCount).to.be(1); }); //layerremove it('fires layerremove when a marker is removed while not on the map', function() { var callback = sinon.spy(); group = new L.MarkerClusterGroup(); group.on('layerremove', callback); var marker = new L.Marker([1.5, 1.5]); group.addLayer(marker); group.removeLayer(marker); expect(callback.callCount).to.be(1); }); it('fires layerremove when a vector is removed while not on the map', function() { var callback = sinon.spy(); group = new L.MarkerClusterGroup(); group.on('layerremove', callback); var polygon = new L.Polygon([[1.5, 1.5], [2.0, 1.5], [2.0, 2.0], [1.5, 2.0]]); group.addLayer(polygon); group.removeLayer(polygon); expect(callback.callCount).to.be(1); }); it('fires layerremove when a marker is removed while on the map', function() { var callback = sinon.spy(); group = new L.MarkerClusterGroup(); group.on('layerremove', callback); map.addLayer(group); var marker = new L.Marker([1.5, 1.5]); group.addLayer(marker); group.removeLayer(marker); expect(callback.callCount).to.be(1); }); it('fires layerremove when a vector is removed while on the map', function() { var callback = sinon.spy(); group = new L.MarkerClusterGroup(); group.on('layerremove', callback); map.addLayer(group); var polygon = new L.Polygon([[1.5, 1.5], [2.0, 1.5], [2.0, 2.0], [1.5, 2.0]]); group.addLayer(polygon); group.removeLayer(polygon); expect(callback.callCount).to.be(1); }); it('fires layerremove when a marker is removed using removeLayers while on the map with chunked loading', function() { var callback = sinon.spy(); group = new L.MarkerClusterGroup({ chunkedLoading: true }); group.on('layerremove', callback); map.addLayer(group); var marker = new L.Marker([1.5, 1.5]); group.addLayers([marker]); group.removeLayers([marker]); expect(callback.callCount).to.be(1); }); it('fires layerremove when a vector is removed using removeLayers while on the map with chunked loading', function() { var callback = sinon.spy(); group = new L.MarkerClusterGroup({ chunkedLoading: true }); group.on('layerremove', callback); map.addLayer(group); var polygon = new L.Polygon([[1.5, 1.5], [2.0, 1.5], [2.0, 2.0], [1.5, 2.0]]); group.addLayers([polygon]); group.removeLayers([polygon]); expect(callback.callCount).to.be(1); }); it('fires layerremove when a marker is removed using removeLayers while not on the map with chunked loading', function() { var callback = sinon.spy(); group = new L.MarkerClusterGroup({ chunkedLoading: true }); group.on('layerremove', callback); var marker = new L.Marker([1.5, 1.5]); group.addLayers([marker]); group.removeLayers([marker]); expect(callback.callCount).to.be(1); }); it('fires layerremove when a vector is removed using removeLayers while not on the map with chunked loading', function() { var callback = sinon.spy(); group = new L.MarkerClusterGroup({ chunkedLoading: true }); group.on('layerremove', callback); var polygon = new L.Polygon([[1.5, 1.5], [2.0, 1.5], [2.0, 2.0], [1.5, 2.0]]); group.addLayers([polygon]); group.removeLayers([polygon]); expect(callback.callCount).to.be(1); }); }); /* //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(); group = new L.MarkerClusterGroup(); var marker = new L.Marker([1.5, 1.5]); var marker2 = new L.Marker([1.5, 1.5]); group.on('click', callback); group.addLayers([marker, marker2]); map.addLayer(group); marker.fire('click'); expect(callback.called).to.be(true); }); */ });
Save
cmd:
run