Files
iD/test/spec/svg/vertices.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

31 lines
1.2 KiB
JavaScript

describe('iD.svgVertices', function () {
var context;
var 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 the .shared class to vertices that are members of two or more ways', function () {
var node = iD.osmNode({loc: [0, 0]});
var way1 = iD.osmWay({nodes: [node.id], tags: {highway: 'residential'}});
var way2 = iD.osmWay({nodes: [node.id], tags: {highway: 'residential'}});
var graph = iD.coreGraph([node, way1, way2]);
var filter = function() { return true; };
var extent = iD.geoExtent([0, 0], [1, 1]);
surface.call(iD.svgVertices(projection, context), graph, [node], filter, extent);
expect(surface.select('.vertex').classed('shared')).to.be.true;
});
});