Test and fixup centerEase

This commit is contained in:
Tom MacWright
2013-01-23 11:35:31 -05:00
parent 75ea4d318e
commit 5c65af512d
2 changed files with 19 additions and 0 deletions
+1
View File
@@ -273,6 +273,7 @@ iD.Map = function() {
map.center(iD.geo.interp(from, loc, (t += 1) / 10));
return t == 10;
}, 20);
return map;
};
map.extent = function(_) {
+18
View File
@@ -42,6 +42,12 @@ describe('iD.Map', function() {
});
});
describe('#minzoom', function() {
it('is zero by default', function() {
expect(map.minzoom()).to.equal(0);
});
});
describe('#center', function() {
it('gets and sets center', function() {
expect(map.center([0, 0])).to.equal(map);
@@ -52,6 +58,18 @@ describe('iD.Map', function() {
});
});
describe('#centerEase', function() {
it('sets center', function(done) {
expect(map.center([10, 10])).to.equal(map);
expect(map.centerEase([20, 20])).to.equal(map);
window.setTimeout(function() {
expect(map.center()[0]).to.be.closeTo(20, 0.5);
expect(map.center()[1]).to.be.closeTo(20, 0.5);
done();
}, 500);
});
});
describe('#centerZoom', function() {
it('gets and sets center and zoom', function() {
expect(map.centerZoom([20, 25], 4)).to.equal(map);