Leaflet/spec/suites/map/handler/Map.DragSpec.js

39 lines
1.1 KiB
JavaScript
Raw Normal View History

describe("Map.Drag", function () {
describe("#addHook", function () {
it("calls the map with dragging enabled", function () {
2015-09-25 18:55:37 +08:00
var container = document.createElement('div');
var 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 () {
2015-09-25 18:55:37 +08:00
var container = document.createElement('div');
var 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; " +
2015-09-25 18:55:37 +08:00
"enables dragging after setting center and zoom", function () {
var container = document.createElement('div');
var 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);
});
});
});