When reversing tags for joins, include "oneway"

This commit is contained in:
John Firebaugh
2015-10-18 13:29:16 -07:00
parent 66e8f78aa7
commit 0517f8e2b3
4 changed files with 24 additions and 4 deletions
+18
View File
@@ -23,6 +23,24 @@ describe("iD.actions.Reverse", function () {
expect(graph.entity(way.id).tags).to.eql({'oneway': 'yes'});
});
it("reverses oneway tags if reverseOneway: true is provided", function () {
var graph = iD.Graph([
iD.Way({id: 'yes', tags: {oneway: 'yes'}}),
iD.Way({id: 'no', tags: {oneway: 'no'}}),
iD.Way({id: '1', tags: {oneway: '1'}}),
iD.Way({id: '-1', tags: {oneway: '-1'}})
]);
expect(iD.actions.Reverse('yes', {reverseOneway: true})(graph)
.entity('yes').tags).to.eql({oneway: '-1'});
expect(iD.actions.Reverse('no', {reverseOneway: true})(graph)
.entity('no').tags).to.eql({oneway: 'no'});
expect(iD.actions.Reverse('1', {reverseOneway: true})(graph)
.entity('1').tags).to.eql({oneway: '-1'});
expect(iD.actions.Reverse('-1', {reverseOneway: true})(graph)
.entity('-1').tags).to.eql({oneway: 'yes'});
});
it("transforms *:right=* ⟺ *:left=*", function () {
var way = iD.Way({tags: {'cycleway:right': 'lane'}}),
graph = iD.Graph([way]);
+2 -2
View File
@@ -86,11 +86,11 @@ describe("iD.geo.joinWays", function() {
iD.Node({id: 'b'}),
iD.Node({id: 'c'}),
iD.Way({id: '-', nodes: ['a', 'b']}),
iD.Way({id: '=', nodes: ['c', 'b'], tags: {'lanes:forward': 2}})
iD.Way({id: '=', nodes: ['c', 'b'], tags: {'oneway': 'yes', 'lanes:forward': 2}})
]);
var result = iD.geo.joinWays([graph.entity('-'), graph.entity('=')], graph);
expect(result[0][1].tags).to.eql({'lanes:backward': 2});
expect(result[0][1].tags).to.eql({'oneway': '-1', 'lanes:backward': 2});
});
it("ignores non-way members", function() {