File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -2742,6 +2742,38 @@ describe('legend with custom doubleClickDelay', function() {
2742
2742
. then ( _assert ( '[short] after click + (1.1*t) delay + click' , 2 , 0 ) )
2743
2743
. then ( done , done . fail ) ;
2744
2744
} , 3 * jasmine . DEFAULT_TIMEOUT_INTERVAL ) ;
2745
+
2746
+ it ( 'custom plotly_legenddoubleclick handler should fire even when plotly_legendclick has been cancelled' , function ( done ) {
2747
+ var tShort = 0.75 * DBLCLICKDELAY ;
2748
+ var dblClickCnt = 0 ;
2749
+ var newPlot = function ( fig ) {
2750
+ return Plotly . newPlot ( gd , fig ) . then ( function ( ) {
2751
+ gd . on ( 'plotly_legendclick' , function ( ) { return false ; } ) ;
2752
+ gd . on ( 'plotly_legenddoubleclick' , function ( ) { dblClickCnt ++ ; } ) ;
2753
+ } ) ;
2754
+ } ;
2755
+
2756
+ function _assert ( msg , _dblClickCnt ) {
2757
+ return function ( ) {
2758
+ expect ( dblClickCnt ) . toBe ( _dblClickCnt , msg + '| dblClickCnt' ) ;
2759
+ dblClickCnt = 0 ;
2760
+ } ;
2761
+ }
2762
+
2763
+ newPlot ( {
2764
+ data : [
2765
+ { y : [ 1 , 2 , 1 ] } ,
2766
+ { y : [ 2 , 1 , 2 ] }
2767
+ ] ,
2768
+ layout : { } ,
2769
+ config : { }
2770
+ } )
2771
+ . then ( click ( 0 ) )
2772
+ . then ( delay ( tShort ) )
2773
+ . then ( click ( 0 ) )
2774
+ . then ( _assert ( 'Double click increases count' , 1 ) )
2775
+ . then ( done ) ;
2776
+ } , 3 * jasmine . DEFAULT_TIMEOUT_INTERVAL ) ;
2745
2777
} ) ;
2746
2778
2747
2779
describe ( 'legend with custom legendwidth' , function ( ) {
You can’t perform that action at this time.
0 commit comments