mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-15 21:48:20 +02:00
Test and fixup centerEase
This commit is contained in:
@@ -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(_) {
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user