From 5fa8dfa5a567289c2757712ac6dfb00f709ac6d1 Mon Sep 17 00:00:00 2001 From: Mattias Bengtsson Date: Wed, 12 Dec 2012 00:17:36 +0100 Subject: [PATCH] Add test for ensuring maxZoom and minZoom on the map overrides any layer settings. --- spec/suites/map/MapSpec.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/spec/suites/map/MapSpec.js b/spec/suites/map/MapSpec.js index 74eff4ee..5f10ba25 100644 --- a/spec/suites/map/MapSpec.js +++ b/spec/suites/map/MapSpec.js @@ -39,4 +39,16 @@ describe("Map", function () { map.setView([51.505, -0.09], 13); }); }); + + describe("#getMinZoom and #getMaxZoom", function () { + it("The minZoom and maxZoom options overrides any" + + " minZoom and maxZoom set on layers", function () { + var c = document.createElement('div'), + map = L.map(c, { minZoom: 5, maxZoom: 10 }); + L.tileLayer("{z}{x}{y}", { minZoom:0, maxZoom: 10 }).addTo(map); + L.tileLayer("{z}{x}{y}", { minZoom:5, maxZoom: 15 }).addTo(map); + expect(map.getMinZoom()).toBe(5); + expect(map.getMaxZoom()).toBe(10); + }); + }); });