@@ -520,6 +520,7 @@ describe('Test polar interactions:', function() {
520520 ] ;
521521
522522 beforeEach ( function ( ) {
523+ jasmine . DEFAULT_TIMEOUT_INTERVAL = 5000 ;
523524 eventData = '' ;
524525 eventCnts = { } ;
525526 gd = createGraphDiv ( ) ;
@@ -528,7 +529,7 @@ describe('Test polar interactions:', function() {
528529 afterEach ( destroyGraphDiv ) ;
529530
530531 function _plot ( fig ) {
531- return Plotly . plot ( gd , fig ) . then ( function ( ) {
532+ return Plotly . newPlot ( gd , fig ) . then ( function ( ) {
532533 eventNames . forEach ( function ( k ) {
533534 eventCnts [ k ] = 0 ;
534535 gd . on ( k , function ( d ) {
@@ -704,6 +705,9 @@ describe('Test polar interactions:', function() {
704705 it ( 'should response to drag interactions on plot area' , function ( done ) {
705706 var fig = Lib . extendDeep ( { } , require ( '@mocks/polar_scatter.json' ) ) ;
706707
708+ // to avoid dragging on hover labels
709+ fig . layout . hovermode = false ;
710+
707711 // adjust margins so that middle of plot area is at 300x300
708712 // with its middle at [200,200]
709713 fig . layout . width = 400 ;
@@ -741,14 +745,16 @@ describe('Test polar interactions:', function() {
741745 }
742746
743747 function _reset ( ) {
744- return _doubleClick ( mid ) . then ( function ( ) {
745- relayoutNumber ++ ;
746- resetNumber ++ ;
747-
748- var extra = '(reset ' + resetNumber + ')' ;
749- _assertBase ( extra ) ;
750- expect ( eventCnts . plotly_doubleclick ) . toBe ( resetNumber , 'doubleclick event #' + extra ) ;
751- } ) ;
748+ return delay ( 100 ) ( )
749+ . then ( function ( ) { return _doubleClick ( mid ) ; } )
750+ . then ( function ( ) {
751+ relayoutNumber ++ ;
752+ resetNumber ++ ;
753+
754+ var extra = '(reset ' + resetNumber + ')' ;
755+ _assertBase ( extra ) ;
756+ expect ( eventCnts . plotly_doubleclick ) . toBe ( resetNumber , 'doubleclick event #' + extra ) ;
757+ } ) ;
752758 }
753759
754760 _plot ( fig )
@@ -790,6 +796,9 @@ describe('Test polar interactions:', function() {
790796 it ( 'should response to drag interactions on radial drag area' , function ( done ) {
791797 var fig = Lib . extendDeep ( { } , require ( '@mocks/polar_scatter.json' ) ) ;
792798
799+ // to avoid dragging on hover labels
800+ fig . layout . hovermode = false ;
801+
793802 // adjust margins so that middle of plot area is at 300x300
794803 // with its middle at [200,200]
795804 fig . layout . width = 400 ;
@@ -803,18 +812,7 @@ describe('Test polar interactions:', function() {
803812 // to activate the radial drag mode
804813 function _drag ( p0 , dp ) {
805814 var node = d3 . select ( '.polar > .draglayer > .radialdrag' ) . node ( ) ;
806- var p1 = [ p0 [ 0 ] + dp [ 0 ] / 2 , p0 [ 1 ] + dp [ 1 ] / 2 ] ;
807- var p2 = [ p0 [ 0 ] + dp [ 0 ] , p0 [ 1 ] + dp [ 1 ] ] ;
808-
809- mouseEvent ( 'mousemove' , p0 [ 0 ] , p0 [ 1 ] , { element : node } ) ;
810- mouseEvent ( 'mousedown' , p0 [ 0 ] , p0 [ 1 ] , { element : node } ) ;
811-
812- return delay ( 250 ) ( )
813- . then ( function ( ) { mouseEvent ( 'mousemove' , p1 [ 0 ] , p1 [ 1 ] , { element : document } ) ; } )
814- . then ( delay ( 50 ) )
815- . then ( function ( ) { mouseEvent ( 'mousemove' , p2 [ 0 ] , p2 [ 1 ] , { element : document } ) ; } )
816- . then ( function ( ) { mouseEvent ( 'mouseup' , p2 [ 0 ] , p2 [ 1 ] , { element : document } ) ; } )
817- . then ( delay ( 50 ) ) ;
815+ return drag ( node , dp [ 0 ] , dp [ 1 ] , null , p0 [ 0 ] , p0 [ 1 ] , 2 ) ;
818816 }
819817
820818 function _assert ( rng , angle , evtRng1 , evtAngle , msg ) {
@@ -839,13 +837,15 @@ describe('Test polar interactions:', function() {
839837 }
840838
841839 function _reset ( ) {
842- return _doubleClick ( [ 200 , 200 ] ) . then ( function ( ) {
843- resetNumber ++ ;
844-
845- var extra = '(reset ' + resetNumber + ')' ;
846- _assertBase ( extra ) ;
847- expect ( eventCnts . plotly_doubleclick ) . toBe ( resetNumber , 'doubleclick event #' + extra ) ;
848- } ) ;
840+ return delay ( 100 ) ( )
841+ . then ( function ( ) { return _doubleClick ( [ 200 , 200 ] ) ; } )
842+ . then ( function ( ) {
843+ resetNumber ++ ;
844+
845+ var extra = '(reset ' + resetNumber + ')' ;
846+ _assertBase ( extra ) ;
847+ expect ( eventCnts . plotly_doubleclick ) . toBe ( resetNumber , 'doubleclick event #' + extra ) ;
848+ } ) ;
849849 }
850850
851851 _plot ( fig )
@@ -880,6 +880,9 @@ describe('Test polar interactions:', function() {
880880 it ( 'should response to drag interactions on angular drag area' , function ( done ) {
881881 var fig = Lib . extendDeep ( { } , require ( '@mocks/polar_scatter.json' ) ) ;
882882
883+ // to avoid dragging on hover labels
884+ fig . layout . hovermode = false ;
885+
883886 // adjust margins so that middle of plot area is at 300x300
884887 // with its middle at [200,200]
885888 fig . layout . width = 400 ;
@@ -909,13 +912,15 @@ describe('Test polar interactions:', function() {
909912 }
910913
911914 function _reset ( ) {
912- return _doubleClick ( [ 200 , 200 ] ) . then ( function ( ) {
913- resetNumber ++ ;
914-
915- var extra = '(reset ' + resetNumber + ')' ;
916- _assertBase ( extra ) ;
917- expect ( eventCnts . plotly_doubleclick ) . toBe ( resetNumber , 'doubleclick event #' + extra ) ;
918- } ) ;
915+ return delay ( 100 ) ( )
916+ . then ( function ( ) { return _doubleClick ( [ 200 , 200 ] ) ; } )
917+ . then ( function ( ) {
918+ resetNumber ++ ;
919+
920+ var extra = '(reset ' + resetNumber + ')' ;
921+ _assertBase ( extra ) ;
922+ expect ( eventCnts . plotly_doubleclick ) . toBe ( resetNumber , 'doubleclick event #' + extra ) ;
923+ } ) ;
919924 }
920925
921926 _plot ( fig )
0 commit comments