mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Tests for adding an individual marker and having it now show up.
This commit is contained in:
@@ -28,7 +28,9 @@
|
||||
<!-- spec files -->
|
||||
|
||||
<script type="text/javascript" src="suites/SpecHelper.js"></script>
|
||||
|
||||
<script type="text/javascript" src="suites/LeafletSpec.js"></script>
|
||||
<script type="text/javascript" src="suites/AddLayerSpec.js"></script>
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
describe('addLayer', 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('adds an individual marker that is added 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('adds an individual marker that is added 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('adds (using animations) an individual marker that is 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 add an individual marker that is too far away that is 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 add an individual marker that is too far away that is 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);
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
Reference in New Issue
Block a user