added a spec test for worldCopyJump set Center and Zoom fix #1982

This commit is contained in:
fastrde 2013-08-18 03:18:21 +02:00
parent 21a282d38b
commit a8a8ebe309
2 changed files with 43 additions and 0 deletions

View File

@ -74,6 +74,9 @@
<!-- /map -->
<script type="text/javascript" src="suites/map/MapSpec.js"></script>
<!-- /map/handler -->
<script type="text/javascript" src="suites/map/handler/Map.DragSpec.js"></script>
<script>
(window.mochaPhantomJS || window.mocha).run();
</script>

View File

@ -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);
});
});
});