2013-11-08 05:54:33 +08:00
|
|
|
describe("Map.Drag", function () {
|
2013-08-18 09:18:21 +08:00
|
|
|
describe("#addHook", function () {
|
|
|
|
it("calls the map with dragging enabled", function () {
|
|
|
|
var container = document.createElement('div'),
|
2013-11-08 05:54:33 +08:00
|
|
|
map = new L.Map(container, {
|
2013-08-18 09:18:21 +08:00
|
|
|
dragging: true
|
|
|
|
});
|
2013-11-08 05:54:33 +08:00
|
|
|
|
|
|
|
expect(map.dragging.enabled()).to.be(true);
|
|
|
|
map.setView([0, 0], 0);
|
|
|
|
expect(map.dragging.enabled()).to.be(true);
|
2013-08-18 09:18:21 +08:00
|
|
|
});
|
|
|
|
it("calls the map with dragging and worldCopyJump enabled", function () {
|
|
|
|
var container = document.createElement('div'),
|
2013-11-08 05:54:33 +08:00
|
|
|
map = new L.Map(container, {
|
2013-08-18 09:18:21 +08:00
|
|
|
dragging: true,
|
|
|
|
worldCopyJump: true
|
|
|
|
});
|
2013-11-08 05:54:33 +08:00
|
|
|
|
|
|
|
expect(map.dragging.enabled()).to.be(true);
|
|
|
|
map.setView([0, 0], 0);
|
|
|
|
expect(map.dragging.enabled()).to.be(true);
|
2013-08-18 09:18:21 +08:00
|
|
|
});
|
2013-11-08 05:54:33 +08:00
|
|
|
it("calls the map with dragging disabled and worldCopyJump enabled; " +
|
|
|
|
"enables dragging after setting center and zoom", function () {
|
2013-08-18 09:18:21 +08:00
|
|
|
var container = document.createElement('div'),
|
2013-11-08 05:54:33 +08:00
|
|
|
map = new L.Map(container, {
|
2013-08-18 09:18:21 +08:00
|
|
|
dragging: false,
|
|
|
|
worldCopyJump: true
|
|
|
|
});
|
|
|
|
|
2013-11-08 05:54:33 +08:00
|
|
|
expect(map.dragging.enabled()).to.be(false);
|
|
|
|
map.setView([0, 0], 0);
|
|
|
|
map.dragging.enable();
|
|
|
|
expect(map.dragging.enabled()).to.be(true);
|
|
|
|
});
|
2013-08-18 09:18:21 +08:00
|
|
|
});
|
|
|
|
});
|