Files
iD/test/spec/svg/points.js
Bryan Housel 33fab5580b Before calling init() make sure the assetPath is set
init kicks off building the ui, which can fetch spritesheets for the <defs>
The assetPath needs to be set otherwise these files will not be found
2021-08-16 22:06:42 -04:00

27 lines
944 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().assetPath('../dist/').init();
d3.select(document.createElement('div'))
.attr('class', 'main-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;
});
});