added a spec test for worldCopyJump set Center and Zoom fix #1982
This commit is contained in:
parent
21a282d38b
commit
a8a8ebe309
@ -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>
|
||||
|
40
spec/suites/map/handler/Map.DragSpec.js
Normal file
40
spec/suites/map/handler/Map.DragSpec.js
Normal 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);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
Loading…
Reference in New Issue
Block a user