mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-27 18:32:25 +02:00
Fix .shared classing
Now that Graph#parentWays is cached, the specialized Graph#parentStructure method is no longer necessary. This commit also demonstrates that it's relatively easy to write specs for rendering now!
This commit is contained in:
@@ -139,6 +139,7 @@
|
||||
<script src="spec/renderer/hash.js"></script>
|
||||
<script src="spec/renderer/map.js"></script>
|
||||
|
||||
<script src="spec/svg/vertices.js"></script>
|
||||
<script src="spec/svg/tag_classes.js"></script>
|
||||
|
||||
<script src="spec/ui/inspector.js"></script>
|
||||
|
||||
@@ -57,6 +57,7 @@
|
||||
<script src="spec/renderer/hash.js"></script>
|
||||
<script src="spec/renderer/map.js"></script>
|
||||
|
||||
<script src="spec/svg/vertices.js"></script>
|
||||
<script src="spec/svg/tag_classes.js"></script>
|
||||
|
||||
<script src="spec/ui/inspector.js"></script>
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
describe("iD.svg.Vertices", function () {
|
||||
var surface,
|
||||
projection = d3.geo.mercator(),
|
||||
filter = d3.functor(true);
|
||||
|
||||
beforeEach(function () {
|
||||
surface = d3.select(document.createElementNS('http://www.w3.org/2000/svg', 'svg'));
|
||||
|
||||
surface.append('g')
|
||||
.attr('class', 'layer-hit');
|
||||
});
|
||||
|
||||
// TODO: fill out
|
||||
|
||||
it("adds the .shared class to vertices that are members of two or more ways", function () {
|
||||
var node = iD.Node({loc: [0, 0]}),
|
||||
way1 = iD.Way({nodes: [node.id]}),
|
||||
way2 = iD.Way({nodes: [node.id]}),
|
||||
graph = iD.Graph([node, way1, way2]);
|
||||
|
||||
surface.call(iD.svg.Vertices(), graph, [node], filter, projection);
|
||||
|
||||
expect(surface.select('.vertex').classed('shared')).to.equal(true);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user