File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed
Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff 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+ } ) ;
You can’t perform that action at this time.
0 commit comments