From f64c2df17ff81421eb9e9f9ccf2339c0153f2e52 Mon Sep 17 00:00:00 2001 From: John Firebaugh Date: Thu, 17 Jan 2013 10:40:14 -0800 Subject: [PATCH] Return null rather than empty string Empty string still generates the error 'Problem parsing d=""', while null results in no 'd' attribute at all. --- js/id/svg.js | 2 +- test/spec/svg.js | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/js/id/svg.js b/js/id/svg.js index bf73f32b8..e2b1dc2ad 100644 --- a/js/id/svg.js +++ b/js/id/svg.js @@ -19,7 +19,7 @@ iD.svg = { } if (entity.nodes.length === 0) { - return (cache[entity.id] = ''); + return (cache[entity.id] = null); } return (cache[entity.id] = diff --git a/test/spec/svg.js b/test/spec/svg.js index bbb78c990..265562071 100644 --- a/test/spec/svg.js +++ b/test/spec/svg.js @@ -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; + }); });