mirror of
https://github.com/FoggedLens/iD.git
synced 2026-02-13 09:12:52 +00:00
More area tests
This commit is contained in:
@@ -41,7 +41,7 @@ iD.svg.Areas = function(projection) {
|
||||
var lineString = iD.svg.LineString(projection);
|
||||
|
||||
function drawPaths(group, areas, filter, classes) {
|
||||
var paths = group.selectAll('path')
|
||||
var paths = group.selectAll('path.area')
|
||||
.filter(filter)
|
||||
.data(areas, iD.Entity.key);
|
||||
|
||||
|
||||
@@ -8,6 +8,16 @@ describe("iD.svg.Areas", function () {
|
||||
.call(iD.svg.Surface());
|
||||
});
|
||||
|
||||
it("adds way and area classes", function () {
|
||||
var area = iD.Way({tags: {area: 'yes'}}),
|
||||
graph = iD.Graph([area]);
|
||||
|
||||
surface.call(iD.svg.Areas(projection), graph, [area], filter);
|
||||
|
||||
expect(surface.select('path')).to.be.classed('way');
|
||||
expect(surface.select('path')).to.be.classed('area');
|
||||
});
|
||||
|
||||
it("adds tag classes", function () {
|
||||
var area = iD.Way({tags: {area: 'yes', building: 'yes'}}),
|
||||
graph = iD.Graph([area]);
|
||||
@@ -17,4 +27,17 @@ describe("iD.svg.Areas", function () {
|
||||
expect(surface.select('.area')).to.be.classed('tag-building');
|
||||
expect(surface.select('.area')).to.be.classed('tag-building-yes');
|
||||
});
|
||||
|
||||
it("preserves non-area paths", function () {
|
||||
var area = iD.Way({tags: {area: 'yes'}}),
|
||||
graph = iD.Graph([area]);
|
||||
|
||||
surface.select('.layer-fill')
|
||||
.append('path')
|
||||
.attr('class', 'other');
|
||||
|
||||
surface.call(iD.svg.Areas(projection), graph, [area], filter);
|
||||
|
||||
expect(surface.selectAll('.other')[0].length).to.equal(1);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user