|
1 |
| -describe('CircleMarker', function () { |
| 1 | +describe('FeatureGroup', function () { |
| 2 | + var map; |
| 3 | + beforeEach(function () { |
| 4 | + map = L.map(document.createElement('div')); |
| 5 | + map.setView([0, 0], 1); |
| 6 | + }); |
2 | 7 | describe("#_propagateEvent", function () {
|
3 |
| - var map, marker; |
| 8 | + var marker; |
4 | 9 | beforeEach(function () {
|
5 |
| - map = L.map(document.createElement('div')); |
6 |
| - map.setView([0, 0], 1); |
7 | 10 | marker = L.marker([0, 0]);
|
8 | 11 | });
|
9 | 12 | describe("when a Marker is added to multiple FeatureGroups ", function () {
|
|
33 | 36 | });
|
34 | 37 | });
|
35 | 38 | });
|
| 39 | + describe('addLayer', function () { |
| 40 | + it('adds the layer', function () { |
| 41 | + var fg = L.featureGroup(), |
| 42 | + marker = L.marker([0, 0]); |
| 43 | + |
| 44 | + expect(fg.hasLayer(marker)).to.be(false); |
| 45 | + |
| 46 | + fg.addLayer(marker); |
| 47 | + |
| 48 | + expect(fg.hasLayer(marker)).to.be(true); |
| 49 | + }); |
| 50 | + }); |
| 51 | + describe('removeLayer', function () { |
| 52 | + it('removes the layer passed to it', function () { |
| 53 | + var fg = L.featureGroup(), |
| 54 | + marker = L.marker([0, 0]); |
| 55 | + |
| 56 | + fg.addLayer(marker); |
| 57 | + expect(fg.hasLayer(marker)).to.be(true); |
| 58 | + |
| 59 | + fg.removeLayer(marker); |
| 60 | + expect(fg.hasLayer(marker)).to.be(false); |
| 61 | + }); |
| 62 | + it('removes the layer passed to it by id', function () { |
| 63 | + var fg = L.featureGroup(), |
| 64 | + marker = L.marker([0, 0]); |
| 65 | + |
| 66 | + fg.addLayer(marker); |
| 67 | + expect(fg.hasLayer(marker)).to.be(true); |
| 68 | + |
| 69 | + fg.removeLayer(marker._leaflet_id); |
| 70 | + expect(fg.hasLayer(marker)).to.be(false); |
| 71 | + }); |
| 72 | + }); |
36 | 73 | });
|
0 commit comments