Add operationStraighten tests for 2 selected vertices

This commit is contained in:
J Guthrie
2019-01-21 14:38:51 +00:00
committed by Bryan Housel
parent c28f0a77fe
commit f2722fe95f
+18 -2
View File
@@ -24,11 +24,12 @@ describe('iD.operationStraighten', function () {
iD.osmNode({ id: 'n8', type: 'node' }),
iD.osmNode({ id: 'n9', type: 'node' }),
iD.osmNode({ id: 'n10', type: 'node' }),
iD.osmNode({ id: 'n11', type: 'node' }),
iD.osmWay({ id: 'w1', nodes: ['n1', 'n2'] }),
iD.osmWay({ id: 'w2', nodes: ['n2', 'n3', 'n4'] }),
iD.osmWay({ id: 'w3', nodes: ['n4', 'n5', 'n6'] }),
iD.osmWay({ id: 'w4', nodes: ['n7', 'n8', 'n9'] }),
iD.osmWay({ id: 'w5', nodes: ['n2', 'n10'] })
iD.osmWay({ id: 'w4', nodes: ['n7', 'n8', 'n9', 'n10'] }),
iD.osmWay({ id: 'w5', nodes: ['n2', 'n11'] })
]);
});
@@ -71,5 +72,20 @@ describe('iD.operationStraighten', function () {
var result = iD.operationStraighten(['w1', 'w3', 'w2'], fakeContext.graph()).available();
expect(result).to.be.ok;
});
it('is available for 2 selected nodes in the same way, more than one node apart', function () {
var result = iD.operationStraighten(['n8', 'n10'], fakeContext.graph()).available();
expect(result).to.be.ok;
});
it('is available for 2 selected nodes in adjacent ways, more than one node apart', function () {
var result = iD.operationStraighten(['n5', 'n3'], fakeContext.graph()).available();
expect(result).to.be.ok;
});
it('is available for 2 selected nodes in non-adjacent ways, providing inbetween ways are selected', function () {
var result = iD.operationStraighten(['n9', 'n1', 'w3', 'w2'], fakeContext.graph()).available();
expect(result).to.be.ok;
});
});
});