@@ -420,4 +420,44 @@ describe('select box and lasso', function() {
420420        . catch ( fail ) 
421421        . then ( done ) ; 
422422    } ) ; 
423+ 
424+     it ( 'should work on scattercarpet traces' ,  function ( done )  { 
425+         var  fig  =  Lib . extendDeep ( { } ,  require ( '@mocks/scattercarpet' ) ) ; 
426+         var  gd  =  createGraphDiv ( ) ; 
427+         var  pts  =  [ ] ; 
428+ 
429+         fig . layout . dragmode  =  'select' ; 
430+ 
431+         function  assertPoints ( expected )  { 
432+             expect ( pts . length ) . toBe ( expected . length ,  'selected points length' ) ; 
433+ 
434+             pts . forEach ( function ( p ,  i )  { 
435+                 var  e  =  expected [ i ] ; 
436+                 expect ( p . a ) . toBe ( e . a ,  'selected pt a val' ) ; 
437+                 expect ( p . b ) . toBe ( e . b ,  'selected pt b val' ) ; 
438+             } ) ; 
439+             pts  =  [ ] ; 
440+         } 
441+ 
442+         Plotly . plot ( gd ,  fig ) . then ( function ( )  { 
443+             gd . on ( 'plotly_selected' ,  function ( data )  { 
444+                 pts  =  data . points ; 
445+             } ) ; 
446+ 
447+             assertSelectionNodes ( 0 ,  0 ) ; 
448+             drag ( [ [ 300 ,  200 ] ,  [ 400 ,  250 ] ] ) ; 
449+             assertSelectionNodes ( 0 ,  2 ) ; 
450+             assertPoints ( [ {  a : 0.2 ,  b : 1.5  } ] ) ; 
451+ 
452+             return  Plotly . relayout ( gd ,  'dragmode' ,  'lasso' ) ; 
453+         } ) 
454+         . then ( function ( )  { 
455+             assertSelectionNodes ( 0 ,  0 ) ; 
456+             drag ( [ [ 300 ,  200 ] ,  [ 400 ,  200 ] ,  [ 400 ,  250 ] ,  [ 300 ,  250 ] ,  [ 300 ,  200 ] ] ) ; 
457+             assertSelectionNodes ( 0 ,  2 ) ; 
458+             assertPoints ( [ {  a : 0.2 ,  b : 1.5  } ] ) ; 
459+         } ) 
460+         . catch ( fail ) 
461+         . then ( done ) ; 
462+     } ) ; 
423463} ) ; 
0 commit comments