File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -51,6 +51,19 @@ test('Test combining 2 ways', () => {
5151 expect ( result [ 0 ] . outerHTML ) . toBe ( way3 ) ;
5252} ) ;
5353
54+ test ( 'Test combining 2 unaligned ways' , ( ) => {
55+ var way1 = '<way id="1"><nd ref="1"/><nd ref="2"/><nd ref="3"/></way>' ;
56+ var way2 = '<way id="2"><nd ref="1"/><nd ref="4"/><nd ref="3"/></way>' ;
57+ var way3 = '<way id="1"><nd ref="1"/><nd ref="2"/><nd ref="3"/><nd ref="4"/><nd ref="1"/></way>' ;
58+ let parser = new window . DOMParser ( ) ;
59+ let xml1 = parser . parseFromString ( way1 , 'text/xml' ) . getElementsByTagName ( 'way' ) [ 0 ] ;
60+ let xml2 = parser . parseFromString ( way2 , 'text/xml' ) . getElementsByTagName ( 'way' ) [ 0 ] ;
61+ let result = BuildingShapeUtils . combineWays ( [ xml1 , xml2 ] ) ;
62+ expect ( result . length ) . toBe ( 1 ) ;
63+ let expected = parser . parseFromString ( way3 , 'text/xml' ) ;
64+ expect ( result [ 0 ] . outerHTML ) . toBe ( way3 ) ;
65+ } ) ;
66+
5467const rightTriangle = new Shape ( ) ;
5568rightTriangle . moveTo ( 1 , 1 ) ;
5669rightTriangle . lineTo ( 1 , - 1 ) ;
You can’t perform that action at this time.
0 commit comments