@@ -520,6 +520,7 @@ describe('Test polar interactions:', function() {
520
520
] ;
521
521
522
522
beforeEach ( function ( ) {
523
+ jasmine . DEFAULT_TIMEOUT_INTERVAL = 5000 ;
523
524
eventData = '' ;
524
525
eventCnts = { } ;
525
526
gd = createGraphDiv ( ) ;
@@ -528,7 +529,7 @@ describe('Test polar interactions:', function() {
528
529
afterEach ( destroyGraphDiv ) ;
529
530
530
531
function _plot ( fig ) {
531
- return Plotly . plot ( gd , fig ) . then ( function ( ) {
532
+ return Plotly . newPlot ( gd , fig ) . then ( function ( ) {
532
533
eventNames . forEach ( function ( k ) {
533
534
eventCnts [ k ] = 0 ;
534
535
gd . on ( k , function ( d ) {
@@ -704,6 +705,9 @@ describe('Test polar interactions:', function() {
704
705
it ( 'should response to drag interactions on plot area' , function ( done ) {
705
706
var fig = Lib . extendDeep ( { } , require ( '@mocks/polar_scatter.json' ) ) ;
706
707
708
+ // to avoid dragging on hover labels
709
+ fig . layout . hovermode = false ;
710
+
707
711
// adjust margins so that middle of plot area is at 300x300
708
712
// with its middle at [200,200]
709
713
fig . layout . width = 400 ;
@@ -741,14 +745,16 @@ describe('Test polar interactions:', function() {
741
745
}
742
746
743
747
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
+ } ) ;
752
758
}
753
759
754
760
_plot ( fig )
@@ -790,6 +796,9 @@ describe('Test polar interactions:', function() {
790
796
it ( 'should response to drag interactions on radial drag area' , function ( done ) {
791
797
var fig = Lib . extendDeep ( { } , require ( '@mocks/polar_scatter.json' ) ) ;
792
798
799
+ // to avoid dragging on hover labels
800
+ fig . layout . hovermode = false ;
801
+
793
802
// adjust margins so that middle of plot area is at 300x300
794
803
// with its middle at [200,200]
795
804
fig . layout . width = 400 ;
@@ -803,18 +812,7 @@ describe('Test polar interactions:', function() {
803
812
// to activate the radial drag mode
804
813
function _drag ( p0 , dp ) {
805
814
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 ) ;
818
816
}
819
817
820
818
function _assert ( rng , angle , evtRng1 , evtAngle , msg ) {
@@ -839,13 +837,15 @@ describe('Test polar interactions:', function() {
839
837
}
840
838
841
839
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
+ } ) ;
849
849
}
850
850
851
851
_plot ( fig )
@@ -880,6 +880,9 @@ describe('Test polar interactions:', function() {
880
880
it ( 'should response to drag interactions on angular drag area' , function ( done ) {
881
881
var fig = Lib . extendDeep ( { } , require ( '@mocks/polar_scatter.json' ) ) ;
882
882
883
+ // to avoid dragging on hover labels
884
+ fig . layout . hovermode = false ;
885
+
883
886
// adjust margins so that middle of plot area is at 300x300
884
887
// with its middle at [200,200]
885
888
fig . layout . width = 400 ;
@@ -909,13 +912,15 @@ describe('Test polar interactions:', function() {
909
912
}
910
913
911
914
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
+ } ) ;
919
924
}
920
925
921
926
_plot ( fig )
0 commit comments