Files
iD/test/spec/svg/points.js
Bryan Housel 2e2b037e36 Move a bunch of commonly used vector and projection math functions into geo
- geoVecAdd
- geoVecSubtract
- geoVecScale
- geoZoomToScale
- geoScaleToZoom
2017-12-18 15:05:42 -05:00

27 lines
907 B
JavaScript

describe('iD.svgPoints', function () {
var context, surface;
var projection = d3.geoProjection(function(x, y) { return [x, -y]; })
.translate([0, 0])
.scale(iD.geoZoomToScale(17))
.clipExtent([[0, 0], [Infinity, Infinity]]);
beforeEach(function () {
context = iD.coreContext();
d3.select(document.createElement('div'))
.attr('id', 'map')
.call(context.map().centerZoom([0, 0], 17));
surface = context.surface();
});
it('adds tag classes', function () {
var point = iD.osmNode({tags: {amenity: 'cafe'}, loc: [0, 0]});
var graph = iD.coreGraph([point]);
surface.call(iD.svgPoints(projection, context), graph, [point]);
expect(surface.select('.point').classed('tag-amenity')).to.be.true;
expect(surface.select('.point').classed('tag-amenity-cafe')).to.be.true;
});
});