42 lines
901 B
JavaScript
42 lines
901 B
JavaScript
|
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);
|
|||
|
});
|
|||
|
});
|