Created
March 23, 2016 08:50
-
-
Save jieter/6455d153800603e74d2c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe.only('maxBounds defined on map', function () { | |
chai.should(); | |
var a, b; | |
afterEach(function () { | |
a.remove(); | |
b.remove(); | |
}); | |
it('should not exceed call stack', function (done) { | |
// Original error: | |
// Uncaught RangeError: Maximum call stack size exceeded | |
// Github issue: https://github.com/turban/Leaflet.Sync/issues/21 | |
var center = [60, 6]; | |
var zoom = 5; | |
var bounds = L.latLngBounds([[50, 0], [60, 10]]); | |
a = L.map(disposableDiv(), {maxBounds: bounds}).setView(center, zoom); | |
b = L.map(disposableDiv(), {maxBounds: bounds}); | |
if (!L.Browser.phantomjs) { | |
// do not show the tile layers in phantomjs to reduce the tile | |
// requests from CI | |
tileLayer().addTo(a); | |
tileLayer('toner').addTo(b); | |
} | |
a.sync(b); | |
b.sync(a); | |
// Visualize the bounds | |
L.rectangle(bounds).addTo(a); | |
// move with a hand | |
var h = new Hand(); | |
var finger = h.growFinger('touch'); | |
finger.wait(10).moveTo(200, 200, 0) | |
.down().moveBy(200, 0, 1000).up() | |
.down().moveBy(-200, 0, 1000).up(); | |
map.on('moveend', function () { | |
done(); | |
}) | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment