@@ -363,6 +363,7 @@ describe('mapboxgl_videoMap', () => {
363363
364364 expect ( videoMap . getDrawMode ( ) ) . toBeNull ( ) ;
365365 expect ( videoMap . getDrawData ( ) . features . length ) . toBe ( 0 ) ;
366+ expect ( videoMap . getDrawLiveData ( ) ) . toEqual ( { type : 'FeatureCollection' , features : [ ] } ) ;
366367
367368 videoMap . startDraw ( 'Point' ) ;
368369 expect ( videoMap . getDrawMode ( ) ) . toBe ( 'Point' ) ;
@@ -376,17 +377,28 @@ describe('mapboxgl_videoMap', () => {
376377 videoMap . startDraw ( 'LineString' ) ;
377378 videoMap . map . fire ( 'click' , { lngLat : { lng : 11587478.81 , lat : 3570800.19 } } ) ;
378379 videoMap . map . fire ( 'click' , { lngLat : { lng : 11587578.81 , lat : 3570900.19 } } ) ;
380+ var lineLiveData = videoMap . getDrawLiveData ( ) ;
381+ expect ( lineLiveData . features . length ) . toBe ( 4 ) ;
382+ expect ( lineLiveData . features . filter ( function ( item ) {
383+ return item . properties . draft ;
384+ } ) . length ) . toBe ( 3 ) ;
385+ expect ( lineLiveData . features . filter ( function ( item ) {
386+ return item . id === 'videomap-draw-draft-line' ;
387+ } ) . length ) . toBe ( 1 ) ;
379388 expect ( videoMap . finishDraw ( ) . geometry . type ) . toBe ( 'LineString' ) ;
380389 expect ( videoMap . getDrawData ( ) . features . length ) . toBe ( 2 ) ;
390+ expect ( videoMap . getDrawLiveData ( ) . features . length ) . toBe ( 2 ) ;
381391
382392 videoMap . startDraw ( 'Polygon' ) ;
383393 videoMap . map . fire ( 'click' , { lngLat : { lng : 11587478.81 , lat : 3570800.19 } } ) ;
384394 videoMap . map . fire ( 'click' , { lngLat : { lng : 11587578.81 , lat : 3570800.19 } } ) ;
385395 videoMap . map . fire ( 'click' , { lngLat : { lng : 11587578.81 , lat : 3570900.19 } } ) ;
396+ expect ( videoMap . getDrawLiveData ( ) . features . length ) . toBe ( 6 ) ;
386397 var polygon = videoMap . finishDraw ( ) ;
387398 expect ( polygon . geometry . type ) . toBe ( 'Polygon' ) ;
388399 expect ( polygon . geometry . coordinates [ 0 ] . length ) . toBe ( 4 ) ;
389400 expect ( videoMap . getDrawData ( ) . features . length ) . toBe ( 3 ) ;
401+ expect ( videoMap . getDrawLiveData ( ) . features . length ) . toBe ( 3 ) ;
390402
391403 videoMap . cancelDraw ( ) ;
392404 expect ( videoMap . getDrawMode ( ) ) . toBeNull ( ) ;
0 commit comments