mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-28 10:51:45 +02:00
Reverse cardinal directions for relation member roles
This commit is contained in:
committed by
John Firebaugh
parent
6c3a3190fd
commit
c43d915625
@@ -114,4 +114,28 @@ describe("iD.actions.Reverse", function () {
|
||||
graph = iD.actions.Reverse(way.id)(graph);
|
||||
expect(graph.entity(relation.id).members[0].role).to.eql('forward');
|
||||
});
|
||||
|
||||
it("transforms role=north ⟺ role=south in member relations", function () {
|
||||
var way = iD.Way({tags: {highway: 'residential'}}),
|
||||
relation = iD.Relation({members: [{type: 'way', id: way.id, role: 'north'}]}),
|
||||
graph = iD.Graph([way, relation]);
|
||||
|
||||
graph = iD.actions.Reverse(way.id)(graph);
|
||||
expect(graph.entity(relation.id).members[0].role).to.eql('south');
|
||||
|
||||
graph = iD.actions.Reverse(way.id)(graph);
|
||||
expect(graph.entity(relation.id).members[0].role).to.eql('north');
|
||||
});
|
||||
|
||||
it("transforms role=east ⟺ role=west in member relations", function () {
|
||||
var way = iD.Way({tags: {highway: 'residential'}}),
|
||||
relation = iD.Relation({members: [{type: 'way', id: way.id, role: 'east'}]}),
|
||||
graph = iD.Graph([way, relation]);
|
||||
|
||||
graph = iD.actions.Reverse(way.id)(graph);
|
||||
expect(graph.entity(relation.id).members[0].role).to.eql('west');
|
||||
|
||||
graph = iD.actions.Reverse(way.id)(graph);
|
||||
expect(graph.entity(relation.id).members[0].role).to.eql('east');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user