Add test cases

This commit is contained in:
J Guthrie
2019-04-08 15:00:19 +01:00
parent d7865ac4aa
commit 57a0358061
2 changed files with 30 additions and 0 deletions
+1
View File
@@ -88,6 +88,7 @@
<script src='spec/operations/detach_node.js'></script>
<script src='spec/operations/straighten.js'></script>
<script src='spec/operations/disconnect.js'></script>
<script src='spec/osm/changeset.js'></script>
<script src='spec/osm/entity.js'></script>
+29
View File
@@ -180,6 +180,35 @@ describe('iD.actionDisconnect', function () {
expect(graph.entity('|').nodes).to.eql(['d', 'b']);
});
it('preserves the closed way when part of a larger disconnect operation', function () {
// Situation:
// a ---- bb === c
// = ==
// = ==
// d
// Disconnect - at b (whilst == is selected).
//
// Expected result:
// a ---- b ee === c
// = ==
// = ==
// d
//
var graph = iD.coreGraph([
iD.osmNode({id: 'a'}),
iD.osmNode({id: 'b'}),
iD.osmNode({id: 'c'}),
iD.osmNode({id: 'd'}),
iD.osmWay({id: '-', nodes: ['a', 'b']}),
iD.osmWay({id: '=', nodes: ['e', 'c', 'd', 'e']})
]);
graph = iD.actionDisconnect('b', 'e').limitWays(['='])(graph);
expect(graph.entity('-').nodes).to.eql(['a', 'b']);
expect(graph.entity('=').nodes).to.eql(['e', 'c', 'd', 'e']);
});
it('replaces later occurrences in a self-intersecting way', function() {
// Situtation:
// a --- b