Skip to content

Commit 2ca96d8

Browse files
authored
Update combine_ways.js
1 parent 02372a8 commit 2ca96d8

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

test/combine_ways.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,18 @@ test('Test combining 2 unaligned ways', () => {
5151
let expected = parser.parseFromString(way3, 'text/xml');
5252
expect(result[0].outerHTML).toBe(way3);
5353
});
54+
55+
test('Test combining 3 ways 1->2->3', () => {
56+
var way1 = '<way id="1"><nd ref="1"/><nd ref="2"/><nd ref="3"/></way>';
57+
var way2 = '<way id="2"><nd ref="3"/><nd ref="4"/><nd ref="5"/></way>';
58+
var way3 = '<way id="3"><nd ref="5"/><nd ref="6"/><nd ref="1"/></way>';
59+
var way4 = '<way id="1"><nd ref="1"/><nd ref="2"/><nd ref="3"/><nd ref="4"/><nd ref="5"/><nd ref="6"/><nd ref="1"/></way>';
60+
let parser = new window.DOMParser();
61+
let xml1 = parser.parseFromString(way1, 'text/xml').getElementsByTagName('way')[0];
62+
let xml2 = parser.parseFromString(way2, 'text/xml').getElementsByTagName('way')[0];
63+
let xml3 = parser.parseFromString(way3, 'text/xml').getElementsByTagName('way')[0];
64+
let result = BuildingShapeUtils.combineWays([xml1, xml2, xml3]);
65+
expect(result.length).toBe(1);
66+
let expected = parser.parseFromString(way4, 'text/xml');
67+
expect(result[0].outerHTML).toBe(way3);
68+
});

0 commit comments

Comments
 (0)