From a8a8ebe309699b308230b4df8e7d23ee22985412 Mon Sep 17 00:00:00 2001 From: fastrde Date: Sun, 18 Aug 2013 03:18:21 +0200 Subject: [PATCH] added a spec test for worldCopyJump set Center and Zoom fix #1982 --- spec/index.html | 3 ++ spec/suites/map/handler/Map.DragSpec.js | 40 +++++++++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 spec/suites/map/handler/Map.DragSpec.js diff --git a/spec/index.html b/spec/index.html index 6454bc2f..2c65a219 100644 --- a/spec/index.html +++ b/spec/index.html @@ -74,6 +74,9 @@ + + + diff --git a/spec/suites/map/handler/Map.DragSpec.js b/spec/suites/map/handler/Map.DragSpec.js new file mode 100644 index 00000000..57b50a7a --- /dev/null +++ b/spec/suites/map/handler/Map.DragSpec.js @@ -0,0 +1,40 @@ +describe("Map.Drag", function(){ + var map; + + describe("#addHook", function () { + it("calls the map with dragging enabled", function () { + var container = document.createElement('div'), + map = new L.Map(container,{ + dragging: true + }); + expect(map.dragging.enabled()).to.be(true); + map.setView([0, 0], 0); + expect(map.dragging.enabled()).to.be(true); + }); + it("calls the map with dragging and worldCopyJump enabled", function () { + var container = document.createElement('div'), + + map = new L.Map(container,{ + dragging: true, + worldCopyJump: true + }); + expect(map.dragging.enabled()).to.be(true); + map.setView([0, 0], 0); + expect(map.dragging.enabled()).to.be(true); + }); + it("calls the map with dragging disabled and worldCopyJump enabled. Enables dragging after setting center and zoom", function () { + var container = document.createElement('div'), + + map = new L.Map(container,{ + dragging: false, + worldCopyJump: true + }); + expect(map.dragging.enabled()).to.be(false); + map.setView([0, 0], 0); + map.dragging.enable(); + expect(map.dragging.enabled()).to.be(true); + }); + + }); + +});