mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-21 07:46:58 +02:00
Expand map tests
This commit is contained in:
@@ -287,6 +287,7 @@ iD.Map = function(elem, connection) {
|
||||
var attr = { width: dimensions[0], height: dimensions[1] };
|
||||
surface.attr(attr).selectAll('#clip-rect').attr(attr);
|
||||
tileclient.setSize(dimensions);
|
||||
return map;
|
||||
}
|
||||
|
||||
function tileAtZoom(t, distance) {
|
||||
@@ -415,6 +416,10 @@ iD.Map = function(elem, connection) {
|
||||
p[0] - (p[0] - translate[0]) / scale0 * scale1,
|
||||
p[1] - (p[1] - translate[1]) / scale0 * scale1
|
||||
]);
|
||||
zoom.scale(scale1).translate([
|
||||
p[0] - (p[0] - translate[0]) / scale0 * scale1,
|
||||
p[1] - (p[1] - translate[1]) / scale0 * scale1
|
||||
]);
|
||||
}
|
||||
|
||||
surface.on('mouseup', function() {
|
||||
|
||||
+20
-1
@@ -12,12 +12,31 @@ describe('Map', function() {
|
||||
});
|
||||
|
||||
describe('#getZoom', function() {
|
||||
it('accurate reports zoom level', function() {
|
||||
it('reports zoom level', function() {
|
||||
expect(map.setZoom(4)).toEqual(map);
|
||||
expect(map.getZoom()).toEqual(4);
|
||||
});
|
||||
});
|
||||
|
||||
describe('#getCenter', function() {
|
||||
it('reports center', function() {
|
||||
expect(map.setCenter([0, 0])).toEqual(map);
|
||||
expect(map.getCenter()).toEqual([0, 0]);
|
||||
expect(map.setCenter([10, 15])).toEqual(map);
|
||||
expect(map.getCenter()[0]).toBeCloseTo(10);
|
||||
expect(map.getCenter()[1]).toBeCloseTo(15);
|
||||
});
|
||||
});
|
||||
|
||||
describe('#getExtent', function() {
|
||||
it('reports extent', function() {
|
||||
expect(map.setSize([100, 100])).toEqual(map);
|
||||
expect(map.setCenter([0, 0])).toEqual(map);
|
||||
expect(map.getExtent()[0][0]).toBeCloseTo(-35.156);
|
||||
expect(map.getExtent()[1][0]).toBeCloseTo(35.156);
|
||||
});
|
||||
});
|
||||
|
||||
describe('#zoomIn', function() {
|
||||
it('changes reported zoom level', function() {
|
||||
expect(map.setZoom(4)).toEqual(map);
|
||||
|
||||
Reference in New Issue
Block a user