Cycle through only_ turn restriction states

(re: #2622)
This commit is contained in:
Bryan Housel
2018-02-07 19:04:28 -05:00
parent 3c340a0362
commit 0cbff57dc9
6 changed files with 42 additions and 37 deletions
+13 -16
View File
@@ -1,24 +1,21 @@
describe('iD.actionUnrestrictTurn', function() {
it('removes a restriction from a restricted turn', function() {
// u====*--->w
var graph = iD.Graph([
iD.Node({id: 'u'}),
iD.Node({id: '*'}),
iD.Node({id: 'w'}),
iD.Way({id: '=', nodes: ['u', '*'], tags: {highway: 'residential'}}),
iD.Way({id: '-', nodes: ['*', 'w'], tags: {highway: 'residential'}}),
iD.Relation({id: 'r', tags: {type: 'restriction'}, members: [
{id: '=', role: 'from', type: 'way'},
{id: '-', role: 'to', type: 'way'},
{id: '*', role: 'via', type: 'node'}
]})
]),
action = iD.actionUnrestrictTurn({
restriction: 'r'
});
var graph = iD.coreGraph([
iD.osmNode({ id: 'u' }),
iD.osmNode({ id: '*' }),
iD.osmNode({ id: 'w' }),
iD.osmWay({ id: '=', nodes: ['u', '*'], tags: { highway: 'residential' } }),
iD.osmWay({ id: '-', nodes: ['*', 'w'], tags: { highway: 'residential' } }),
iD.osmRelation({ id: 'r', tags: { type: 'restriction' }, members: [
{ id: '=', role: 'from', type: 'way' },
{ id: '-', role: 'to', type: 'way' },
{ id: '*', role: 'via', type: 'node' }
]})
]);
var action = iD.actionUnrestrictTurn({ restrictionID: 'r' });
graph = action(graph);
expect(graph.hasEntity('r')).to.be.undefined;
});
});
+3 -3
View File
@@ -338,7 +338,7 @@ describe('iD.osmIntersection', function() {
expect(turns[1]).to.be.an.instanceOf(iD.osmTurn);
expect(turns[1].key).to.eql('=,*,-');
expect(turns[1].u).to.be.not.ok;
expect(turns[1].restriction).to.eql('r');
expect(turns[1].restrictionID).to.eql('r');
expect(turns[1].direct).to.be.true;
expect(turns[1].indirect).to.be.not.ok;
expect(turns[1].only).to.be.not.ok;
@@ -372,7 +372,7 @@ describe('iD.osmIntersection', function() {
expect(turns[1]).to.be.an.instanceOf(iD.osmTurn);
expect(turns[1].key).to.eql('=,*,~');
expect(turns[1].restriction).to.eql('r');
expect(turns[1].restrictionID).to.eql('r');
expect(turns[1].u).to.be.not.ok;
expect(turns[1].direct).to.be.not.ok;
expect(turns[1].indirect).to.be.true;
@@ -380,7 +380,7 @@ describe('iD.osmIntersection', function() {
expect(turns[2]).to.be.an.instanceOf(iD.osmTurn);
expect(turns[2].key).to.eql('=,*,-');
expect(turns[2].restriction).to.eql('r');
expect(turns[2].restrictionID).to.eql('r');
expect(turns[2].u).to.be.not.ok;
expect(turns[2].direct).to.be.not.ok;
expect(turns[2].indirect).to.be.not.ok;