Return null rather than empty string

Empty string still generates the error 'Problem parsing d=""',
while null results in no 'd' attribute at all.
This commit is contained in:
John Firebaugh
2013-01-17 10:40:14 -08:00
parent e24b22b518
commit f64c2df17f
2 changed files with 8 additions and 1 deletions

View File

@@ -19,7 +19,7 @@ iD.svg = {
}
if (entity.nodes.length === 0) {
return (cache[entity.id] = '');
return (cache[entity.id] = null);
}
return (cache[entity.id] =

View File

@@ -7,4 +7,11 @@ describe("iD.svg.LineString", function () {
expect(iD.svg.LineString(projection)(way)).to.equal("M0,0L2,3");
});
it("returns null for an entity with no nodes", function () {
var way = iD.Way(),
projection = Object;
expect(iD.svg.LineString(projection)(way)).to.be.null;
});
});