Last active
February 11, 2016 15:50
-
-
Save jieter/2cc8f3de36571b9d78f9 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Leaflet Spec Runner</title> | |
<link rel="stylesheet" type="text/css" href="../node_modules/mocha/mocha.css"> | |
<link rel="stylesheet" type="text/css" href="../dist/leaflet.css"> | |
</head> | |
<body> | |
<div id="mocha"></div> | |
<script src="../spec/expect.js"></script> | |
<script type="text/javascript" src="../node_modules/mocha/mocha.js"></script> | |
<script type="text/javascript" src="../node_modules/happen/happen.js"></script> | |
<script type="text/javascript" src="../spec/sinon.js"></script> | |
<!-- source files --> | |
<script type="text/javascript" src="../build/deps.js"></script> | |
<script type="text/javascript" src="../debug/leaflet-include.js"></script> | |
<script> | |
mocha.setup({ | |
ui: 'bdd', | |
ignoreLeaks: true | |
}); | |
</script> | |
<!-- spec files --> | |
<script type="text/javascript"> | |
var lat = 52.4, | |
lng = 4.5, | |
zoom = 15; | |
describe('#panBy issue 0.7.5 vs 1.0', function () { | |
it('works in both versions if container size is [0, 0]', function () { | |
var container = document.createElement('div'); | |
var map = L.map(container).setView([lat, lng], zoom); | |
map.panBy([200, 0]); | |
expect(map.getCenter().lng).to.be.greaterThan(lng); | |
}); | |
it('works in both versions if container size is not [0, 0]', function () { | |
var container = document.createElement('div'); | |
container.style.width = '500px'; | |
container.style.height = '500px'; | |
var map = L.map(container).setView([lat, lng], zoom); | |
map.panBy([200, 0]); | |
expect(map.getCenter().lng).to.be.greaterThan(lng); | |
}); | |
it('works fails in 1.0 if container size is not [0, 0] AND container is attached to the DOM', function () { | |
var container = document.createElement('div'); | |
container.style.width = '500px'; | |
container.style.height = '500px'; | |
document.body.appendChild(container); | |
var map = L.map(container).setView([lat, lng], zoom); | |
map.panBy([200, 0]); | |
expect(map.getCenter().lng).to.be.greaterThan(lng); | |
}); | |
it('subscribe to moveend event', function (done) { | |
var container = document.createElement('div'); | |
container.style.width = '500px'; | |
container.style.height = '500px'; | |
document.body.appendChild(container); | |
var map = L.map(container, { | |
fadeAnimation: false, | |
zoomAnimation: false, | |
markerZoomAnimation: false | |
}).setView([lat, lng], zoom); | |
map.on('moveend', function () { | |
expect(map.getCenter().lng).to.be.greaterThan(lng); | |
done(); | |
}) | |
map.panBy([200, 0]); | |
}); | |
}); | |
</script> | |
<script> | |
(window.mochaPhantomJS || window.mocha).run(); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment