@@ -23,7 +23,6 @@ Plotly.setPlotConfig({
2323 mapboxAccessToken : MAPBOX_ACCESS_TOKEN
2424} ) ;
2525
26-
2726describe ( 'mapbox defaults' , function ( ) {
2827 'use strict' ;
2928
@@ -788,31 +787,19 @@ describe('@noCI, mapbox plots', function() {
788787 . then ( done ) ;
789788 } , LONG_TIMEOUT_INTERVAL ) ;
790789
791- it ( 'should respond drag / scroll interactions' , function ( done ) {
792- var relayoutCnt = 0 ,
793- updateData ;
790+ it ( 'should respond drag / scroll / double-click interactions' , function ( done ) {
791+ var relayoutCnt = 0 ;
792+ var doubleClickCnt = 0 ;
793+ var updateData ;
794794
795795 gd . on ( 'plotly_relayout' , function ( eventData ) {
796796 relayoutCnt ++ ;
797797 updateData = eventData ;
798798 } ) ;
799799
800- function _drag ( p0 , p1 , cb ) {
801- var promise = _mouseEvent ( 'mousemove' , p0 , noop ) . then ( function ( ) {
802- return _mouseEvent ( 'mousedown' , p0 , noop ) ;
803- } ) . then ( function ( ) {
804- return _mouseEvent ( 'mousemove' , p1 , noop ) ;
805- } ) . then ( function ( ) {
806- // repeat mousemove to simulate long dragging motion
807- return _mouseEvent ( 'mousemove' , p1 , noop ) ;
808- } ) . then ( function ( ) {
809- return _mouseEvent ( 'mouseup' , p1 , noop ) ;
810- } ) . then ( function ( ) {
811- return _mouseEvent ( 'mouseup' , p1 , noop ) ;
812- } ) . then ( cb ) ;
813-
814- return promise ;
815- }
800+ gd . on ( 'plotly_doubleclick' , function ( ) {
801+ doubleClickCnt ++ ;
802+ } ) ;
816803
817804 function assertLayout ( center , zoom , opts ) {
818805 var mapInfo = getMapInfo ( gd ) ,
@@ -838,8 +825,13 @@ describe('@noCI, mapbox plots', function() {
838825
839826 _drag ( pointPos , p1 , function ( ) {
840827 expect ( relayoutCnt ) . toEqual ( 1 ) ;
841- assertLayout ( [ - 19.651 , 13.751 ] , 1.234 , { withUpdateData : true } ) ;
828+ assertLayout ( [ - 19.651 , 13.751 ] , 1.234 , { withUpdateData : true } ) ;
842829
830+ return _doubleClick ( p1 ) ;
831+ } )
832+ . then ( function ( ) {
833+ expect ( doubleClickCnt ) . toBe ( 1 , 'double click cnt' ) ;
834+ assertLayout ( [ - 4.710 , 19.475 ] , 1.234 ) ;
843835 } )
844836 . catch ( failTest )
845837 . then ( done ) ;
@@ -855,16 +847,6 @@ describe('@noCI, mapbox plots', function() {
855847 ptData = eventData . points [ 0 ] ;
856848 } ) ;
857849
858- function _click ( pos , cb ) {
859- var promise = _mouseEvent ( 'mousemove' , pos , noop ) . then ( function ( ) {
860- return _mouseEvent ( 'mousedown' , pos , noop ) ;
861- } ) . then ( function ( ) {
862- return _mouseEvent ( 'click' , pos , cb ) ;
863- } ) ;
864-
865- return promise ;
866- }
867-
868850 _click ( blankPos , function ( ) {
869851 expect ( ptData ) . toBe ( undefined , 'not firing on blank points' ) ;
870852 } )
@@ -991,6 +973,38 @@ describe('@noCI, mapbox plots', function() {
991973 } , MOUSE_DELAY ) ;
992974 } ) ;
993975 }
976+
977+ function _click ( pos , cb ) {
978+ var promise = _mouseEvent ( 'mousemove' , pos , noop ) . then ( function ( ) {
979+ return _mouseEvent ( 'mousedown' , pos , noop ) ;
980+ } ) . then ( function ( ) {
981+ return _mouseEvent ( 'click' , pos , cb ) ;
982+ } ) ;
983+
984+ return promise ;
985+ }
986+
987+ function _doubleClick ( pos ) {
988+ return _mouseEvent ( 'dblclick' , pos , noop ) ;
989+ }
990+
991+ function _drag ( p0 , p1 , cb ) {
992+ var promise = _mouseEvent ( 'mousemove' , p0 , noop ) . then ( function ( ) {
993+ return _mouseEvent ( 'mousedown' , p0 , noop ) ;
994+ } ) . then ( function ( ) {
995+ return _mouseEvent ( 'mousemove' , p1 , noop ) ;
996+ } ) . then ( function ( ) {
997+ // repeat mousemove to simulate long dragging motion
998+ return _mouseEvent ( 'mousemove' , p1 , noop ) ;
999+ } ) . then ( function ( ) {
1000+ return _mouseEvent ( 'mouseup' , p1 , noop ) ;
1001+ } ) . then ( function ( ) {
1002+ return _mouseEvent ( 'mouseup' , p1 , noop ) ;
1003+ } ) . then ( cb ) ;
1004+
1005+ return promise ;
1006+ }
1007+
9941008} ) ;
9951009
9961010describe ( '@noCI, mapbox toImage' , function ( ) {
0 commit comments