describe('addLayer adding a single marker', 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('appears when added to the group before the group is added to the map', function () { var group = new L.MarkerClusterGroup(); var marker = new L.Marker([1.5, 1.5]); group.addLayer(marker); map.addLayer(group); expect(marker._icon).to.not.be(undefined); expect(marker._icon.parentNode).to.be(map._panes.markerPane); }); it('appears when added to the group after the group is added to the map', function () { var group = new L.MarkerClusterGroup(); var marker = new L.Marker([1.5, 1.5]); map.addLayer(group); group.addLayer(marker); expect(marker._icon).to.not.be(undefined); expect(marker._icon.parentNode).to.be(map._panes.markerPane); }); it('appears (using animations) when added after the group is added to the map', function () { var group = new L.MarkerClusterGroup({ animateAddingMarkers: true }); var marker = new L.Marker([1.5, 1.5]); map.addLayer(group); group.addLayer(marker); expect(marker._icon).to.not.be(undefined); expect(marker._icon.parentNode).to.be(map._panes.markerPane); }); it('does not appear when too far away when added before the group is added to the map', function () { var group = new L.MarkerClusterGroup(); var marker = new L.Marker([3.5, 1.5]); group.addLayer(marker); map.addLayer(group); expect(marker._icon).to.be(undefined); }); it('does not appear when too far away when added after the group is added to the map', function () { var group = new L.MarkerClusterGroup(); var marker = new L.Marker([3.5, 1.5]); map.addLayer(group); group.addLayer(marker); expect(marker._icon).to.be(undefined); }); });