Fix relation role in Split (#694)

This commit is contained in:
John Firebaugh
2013-02-08 20:44:14 -08:00
parent 4a9d41d3fb
commit f1079a644a
2 changed files with 6 additions and 3 deletions
+1 -1
View File
@@ -73,7 +73,7 @@ iD.actions.Split = function(nodeId, newWayId) {
}
}
relation = relation.addMember({id: wayB.id, type: 'wayA', role: role}, i <= j ? i + 1 : i);
relation = relation.addMember({id: wayB.id, type: 'way', role: role}, i <= j ? i + 1 : i);
graph = graph.replace(relation);
}
});
+5 -2
View File
@@ -175,12 +175,15 @@ describe("iD.actions.Split", function () {
'b': iD.Node({id: 'b'}),
'c': iD.Node({id: 'c'}),
'-': iD.Way({id: '-', nodes: ['a', 'b', 'c']}),
'r': iD.Relation({id: 'r', members: [{id: '-', type: 'way'}]})
'r': iD.Relation({id: 'r', members: [{id: '-', type: 'way', role: 'forward'}]})
});
graph = iD.actions.Split('b', '=')(graph);
expect(_.pluck(graph.entity('r').members, 'id')).to.eql(['-', '=']);
expect(graph.entity('r').members).to.eql([
{id: '-', type: 'way', role: 'forward'},
{id: '=', type: 'way', role: 'forward'}
]);
});
it("adds the new way to parent relations (forward order)", function () {