@@ -691,6 +691,26 @@ describe('hover on fill', function() {
691691 } ) . then ( done ) ;
692692 } ) ;
693693
694+ // click and doubleClick copied over from click_test
695+ // TODO require from elsewhere
696+ function click ( x , y ) {
697+ mouseEvent ( 'mousemove' , x , y ) ;
698+ mouseEvent ( 'mousedown' , x , y ) ;
699+ mouseEvent ( 'mouseup' , x , y ) ;
700+ }
701+
702+ function doubleClick ( x , y ) {
703+ return new Promise ( function ( resolve ) {
704+ click ( x , y ) ;
705+
706+ setTimeout ( function ( ) {
707+ click ( x , y ) ;
708+ setTimeout ( function ( ) { resolve ( ) ; } , DBLCLICKDELAY / 2 ) ;
709+ } , DBLCLICKDELAY / 2 ) ;
710+ } ) ;
711+ }
712+ var DBLCLICKDELAY = require ( '@src/plots/cartesian/constants' ) . DBLCLICKDELAY ;
713+
694714 it ( 'should work for scatterternary too' , function ( done ) {
695715 var mock = Lib . extendDeep ( { } , require ( '@mocks/ternary_fill.json' ) ) ;
696716
@@ -706,6 +726,12 @@ describe('hover on fill', function() {
706726 return assertLabelsCorrect ( [ 237 , 218 ] , [ 266.75 , 265 ] , 'trace 1' ) ;
707727 } ) . then ( function ( ) {
708728 return assertLabelsCorrect ( [ 237 , 251 ] , [ 247.7 , 254 ] , 'trace 0' ) ;
729+ } ) . then ( function ( ) {
730+ // trigger an autoscale redraw, which goes through dragElement
731+ return doubleClick ( 237 , 251 ) ;
732+ } ) . then ( function ( ) {
733+ // then make sure we can still select a *different* item afterward
734+ return assertLabelsCorrect ( [ 237 , 218 ] , [ 266.75 , 265 ] , 'trace 1' ) ;
709735 } ) . then ( done ) ;
710736 } ) ;
711737} ) ;
0 commit comments