diff --git a/spec/suites/layer/LayerGroupSpec.js b/spec/suites/layer/LayerGroupSpec.js index 98ce5e2b..21220f8e 100644 --- a/spec/suites/layer/LayerGroupSpec.js +++ b/spec/suites/layer/LayerGroupSpec.js @@ -1,4 +1,13 @@ describe('LayerGroup', function () { + describe("#hasLayer", function () { + it("returns false when passed undefined, null, or false", function () { + var lg = L.layerGroup(); + expect(lg.hasLayer(undefined)).to.equal(false); + expect(lg.hasLayer(null)).to.equal(false); + expect(lg.hasLayer(false)).to.equal(false); + }); + }); + describe("#addLayer", function () { it('adds a layer', function () { var lg = L.layerGroup(), @@ -9,6 +18,7 @@ expect(lg.hasLayer(marker)).to.be(true); }); }); + describe("#removeLayer", function () { it('removes a layer', function () { var lg = L.layerGroup(), @@ -20,6 +30,7 @@ expect(lg.hasLayer(marker)).to.be(false); }); }); + describe("#clearLayers", function () { it('removes all layers', function () { var lg = L.layerGroup(), @@ -31,6 +42,7 @@ expect(lg.hasLayer(marker)).to.be(false); }); }); + describe("#getLayers", function () { it('gets all layers', function () { var lg = L.layerGroup(), @@ -41,6 +53,7 @@ expect(lg.getLayers()).to.eql([marker]); }); }); + describe("#eachLayer", function () { it('iterates over all layers', function () { var lg = L.layerGroup(), diff --git a/spec/suites/map/MapSpec.js b/spec/suites/map/MapSpec.js index 064f1f0e..6d846f09 100644 --- a/spec/suites/map/MapSpec.js +++ b/spec/suites/map/MapSpec.js @@ -199,6 +199,15 @@ describe("Map", function () { }); }); + describe("#hasLayer", function () { + it("returns false when passed undefined, null, or false", function () { + var map = L.map(document.createElement('div')); + expect(map.hasLayer(undefined)).to.equal(false); + expect(map.hasLayer(null)).to.equal(false); + expect(map.hasLayer(false)).to.equal(false); + }); + }); + function layerSpy() { var layer = new L.Layer(); layer.onAdd = sinon.spy();