@@ -96,13 +96,16 @@ function assertEventCounts(selecting, selected, deselect, msg) {
96
96
expect ( deselectCnt ) . toBe ( deselect , 'plotly_deselect call count: ' + msg ) ;
97
97
}
98
98
99
+ // TODO: in v2, when we get rid of the `plotly_selected->undefined` event, these will
100
+ // change to BOXEVENTS = [1, 1, 1], LASSOEVENTS = [4, 1, 1]. See also _run down below
101
+ //
99
102
// events for box or lasso select mouse moves then a doubleclick
100
103
var NOEVENTS = [ 0 , 0 , 0 ] ;
101
104
// deselect used to give an extra plotly_selected event on the first click
102
105
// with undefined event data - but now that's gone, since `clickFn` handles this.
103
- var BOXEVENTS = [ 1 , 1 , 1 ] ;
106
+ var BOXEVENTS = [ 1 , 2 , 1 ] ;
104
107
// assumes 5 points in the lasso path
105
- var LASSOEVENTS = [ 4 , 1 , 1 ] ;
108
+ var LASSOEVENTS = [ 4 , 2 , 1 ] ;
106
109
107
110
describe ( 'Test select box and lasso in general:' , function ( ) {
108
111
var mock = require ( '@mocks/14.json' ) ;
@@ -643,7 +646,11 @@ describe('Test select box and lasso per trace:', function() {
643
646
return ( eventCounts [ 0 ] ? selectedPromise : Promise . resolve ( ) )
644
647
. then ( afterDragFn )
645
648
. then ( function ( ) {
646
- assertEventCounts ( eventCounts [ 0 ] , eventCounts [ 1 ] , 0 , msg + ' (before dblclick)' ) ;
649
+ // TODO: in v2 when we remove the `plotly_selecting->undefined` the Math.max(...)
650
+ // in the middle here will turn into just eventCounts[1].
651
+ // It's just here because one of the selected events is generated during
652
+ // doubleclick so hasn't happened yet when we're testing this.
653
+ assertEventCounts ( eventCounts [ 0 ] , Math . max ( 0 , eventCounts [ 1 ] - 1 ) , 0 , msg + ' (before dblclick)' ) ;
647
654
return doubleClick ( dblClickPos [ 0 ] , dblClickPos [ 1 ] ) ;
648
655
} )
649
656
. then ( eventCounts [ 2 ] ? deselectPromise : Promise . resolve ( ) )
0 commit comments