diff --git a/js/id/graph/relation.js b/js/id/graph/relation.js index e7d4afd0a..a09d6dac0 100644 --- a/js/id/graph/relation.js +++ b/js/id/graph/relation.js @@ -140,7 +140,7 @@ _.extend(iD.Relation.prototype, { if (o !== undefined) result[o].push(inners[i]); else - result.push(inners[i]); // Invalid geometry + result.push([inners[i]]); // Invalid geometry } return result; diff --git a/test/spec/graph/relation.js b/test/spec/graph/relation.js index f8b49a213..58b1767f4 100644 --- a/test/spec/graph/relation.js +++ b/test/spec/graph/relation.js @@ -298,6 +298,17 @@ describe('iD.Relation', function () { expect(r.multipolygon(graph)).to.eql([[[a, b, c, a], [d, e, f, d]], [[g, h, i, g]]]); }); + specify("invalid geometry: unmatched inner", function () { + var a = iD.Node(), + b = iD.Node(), + c = iD.Node(), + w = iD.Way({nodes: [a.id, b.id, c.id, a.id]}), + r = iD.Relation({members: [{id: w.id, role: 'inner', type: 'way'}]}), + g = iD.Graph([a, b, c, w, r]); + + expect(r.multipolygon(g)).to.eql([[[a, b, c, a]]]); + }); + specify("incomplete relation", function () { var a = iD.Node(), b = iD.Node(),