@@ -13,6 +13,8 @@ var mouseEvent = require('../assets/mouse_event');
13
13
var touchEvent = require ( '../assets/touch_event' ) ;
14
14
15
15
var LONG_TIMEOUT_INTERVAL = 5 * jasmine . DEFAULT_TIMEOUT_INTERVAL ;
16
+ var delay = require ( '../assets/delay' ) ;
17
+ var sankeyConstants = require ( '@src/traces/sankey/constants' ) ;
16
18
17
19
function drag ( path , options ) {
18
20
var len = path . length ;
@@ -2667,45 +2669,62 @@ describe('Test select box and lasso per trace:', function() {
2667
2669
. then ( done ) ;
2668
2670
} ) ;
2669
2671
2670
- it ( '@flaky should work on sankey traces' , function ( done ) {
2671
- var fig = Lib . extendDeep ( { } , require ( '@mocks/sankey_circular.json' ) ) ;
2672
- fig . layout . dragmode = 'select' ;
2673
- var dblClickPos = [ 250 , 400 ] ;
2674
- var opts = { } ;
2672
+ describe ( 'should work on sankey traces' , function ( ) {
2673
+ var waitingTime = sankeyConstants . duration * 2 ;
2675
2674
2676
- Plotly . plot ( gd , fig )
2677
- . then ( function ( ) {
2678
- // No groups initially
2679
- expect ( gd . _fullData [ 0 ] . node . groups ) . toEqual ( [ ] ) ;
2675
+ it ( '@flaky select' , function ( done ) {
2676
+ var fig = Lib . extendDeep ( { } , require ( '@mocks/sankey_circular.json' ) ) ;
2677
+ fig . layout . dragmode = 'select' ;
2678
+ var dblClickPos = [ 250 , 400 ] ;
2680
2679
2681
- opts . element = document . elementFromPoint ( 400 , 400 ) ;
2682
- } )
2683
- . then ( function ( ) {
2684
- // Grouping the two nodes on the top right
2685
- return _run (
2686
- [ [ 640 , 130 ] , [ 400 , 450 ] ] ,
2687
- function ( ) {
2688
- expect ( gd . _fullData [ 0 ] . node . groups ) . toEqual ( [ [ 2 , 3 ] ] ) ;
2689
- } ,
2690
- dblClickPos , BOXEVENTS , 'for top right nodes #2 and #3'
2691
- ) ;
2692
- } )
2693
- . then ( function ( ) {
2694
- // Grouping node #4 and the previous group
2695
- drag ( [ [ 715 , 400 ] , [ 300 , 110 ] ] , opts ) ;
2696
- } )
2697
- . then ( function ( ) {
2698
- expect ( gd . _fullData [ 0 ] . node . groups ) . toEqual ( [ [ 4 , 3 , 2 ] ] ) ;
2699
- } )
2700
- . then ( function ( ) {
2701
- // Grouping node #0 and #1 on the left side
2702
- drag ( [ [ 160 , 110 ] , [ 200 , 590 ] ] , opts ) ;
2703
- } )
2704
- . then ( function ( ) {
2705
- expect ( gd . _fullData [ 0 ] . node . groups ) . toEqual ( [ [ 4 , 3 , 2 ] , [ 0 , 1 ] ] ) ;
2706
- } )
2707
- . catch ( failTest )
2708
- . then ( done ) ;
2680
+ Plotly . plot ( gd , fig )
2681
+ . then ( function ( ) {
2682
+ // No groups initially
2683
+ expect ( gd . _fullData [ 0 ] . node . groups ) . toEqual ( [ ] ) ;
2684
+ } )
2685
+ . then ( function ( ) {
2686
+ // Grouping the two nodes on the top right
2687
+ return _run (
2688
+ [ [ 640 , 130 ] , [ 400 , 450 ] ] ,
2689
+ function ( ) {
2690
+ expect ( gd . _fullData [ 0 ] . node . groups ) . toEqual ( [ [ 2 , 3 ] ] , 'failed to group #2 + #3' ) ;
2691
+ } ,
2692
+ dblClickPos , BOXEVENTS , 'for top right nodes #2 and #3'
2693
+ ) ;
2694
+ } )
2695
+ . then ( delay ( waitingTime ) )
2696
+ . then ( function ( ) {
2697
+ // Grouping node #4 and the previous group
2698
+ drag ( [ [ 715 , 400 ] , [ 300 , 110 ] ] ) ;
2699
+ } )
2700
+ . then ( delay ( waitingTime ) )
2701
+ . then ( function ( ) {
2702
+ expect ( gd . _fullData [ 0 ] . node . groups ) . toEqual ( [ [ 4 , 3 , 2 ] ] , 'failed to group #4 + existing group of #2 and #3' ) ;
2703
+ } )
2704
+ . catch ( failTest )
2705
+ . then ( done ) ;
2706
+ } ) ;
2707
+
2708
+ it ( '@flaky should not work when dragmode is undefined' , function ( done ) {
2709
+ var fig = Lib . extendDeep ( { } , require ( '@mocks/sankey_circular.json' ) ) ;
2710
+ fig . layout . dragmode = undefined ;
2711
+
2712
+ Plotly . plot ( gd , fig )
2713
+ . then ( function ( ) {
2714
+ // No groups initially
2715
+ expect ( gd . _fullData [ 0 ] . node . groups ) . toEqual ( [ ] ) ;
2716
+ } )
2717
+ . then ( function ( ) {
2718
+ // Grouping the two nodes on the top right
2719
+ drag ( [ [ 640 , 130 ] , [ 400 , 450 ] ] ) ;
2720
+ } )
2721
+ . then ( delay ( waitingTime ) )
2722
+ . then ( function ( ) {
2723
+ expect ( gd . _fullData [ 0 ] . node . groups ) . toEqual ( [ ] ) ;
2724
+ } )
2725
+ . catch ( failTest )
2726
+ . then ( done ) ;
2727
+ } ) ;
2709
2728
} ) ;
2710
2729
} ) ;
2711
2730
0 commit comments