@@ -2445,6 +2445,12 @@ describe('hover on subplots when hoversubplots is set to *single* and x hovermod
2445
2445
} ) ;
2446
2446
} ) ;
2447
2447
2448
+ function assertFirstPointOn ( gd , xaxisId , yaxisId ) {
2449
+ // first point should be on the main subplot
2450
+ expect ( gd . _hoverdata [ 0 ] . xaxis . _id ) . toBe ( xaxisId ) ;
2451
+ expect ( gd . _hoverdata [ 0 ] . yaxis . _id ) . toBe ( yaxisId ) ;
2452
+ }
2453
+
2448
2454
describe ( 'hover on subplots when hoversubplots is set to *axis* and x hovermodes' , function ( ) {
2449
2455
'use strict' ;
2450
2456
@@ -2494,6 +2500,9 @@ describe('hover on subplots when hoversubplots is set to *axis* and x hovermodes
2494
2500
Lib . clearThrottle ( ) ;
2495
2501
Plotly . Fx . hover ( gd , { xval : pos } , subplot ) ;
2496
2502
expect ( gd . _hoverdata . length ) . toBe ( 3 ) ;
2503
+
2504
+ assertFirstPointOn ( gd , 'x' , 'y' ) ;
2505
+
2497
2506
assertHoverLabelContent ( {
2498
2507
nums : [ '1' , '10' , '100' ] ,
2499
2508
name : [ 'trace 0' , 'trace 1' , 'trace 2' ] ,
@@ -2505,6 +2514,8 @@ describe('hover on subplots when hoversubplots is set to *axis* and x hovermodes
2505
2514
Lib . clearThrottle ( ) ;
2506
2515
Plotly . Fx . hover ( gd , { xval : pos } , subplot ) ;
2507
2516
2517
+ assertFirstPointOn ( gd , 'x' , 'y2' ) ;
2518
+
2508
2519
expect ( gd . _hoverdata . length ) . toBe ( 3 ) ;
2509
2520
assertHoverLabelContent ( {
2510
2521
nums : [ '2' , '20' , '200' ] ,
@@ -2517,6 +2528,8 @@ describe('hover on subplots when hoversubplots is set to *axis* and x hovermodes
2517
2528
Lib . clearThrottle ( ) ;
2518
2529
Plotly . Fx . hover ( gd , { xval : pos } , subplot ) ;
2519
2530
2531
+ assertFirstPointOn ( gd , 'x' , 'y3' ) ;
2532
+
2520
2533
expect ( gd . _hoverdata . length ) . toBe ( 3 ) ;
2521
2534
assertHoverLabelContent ( {
2522
2535
nums : [ '3' , '30' , '300' ] ,
@@ -2530,6 +2543,8 @@ describe('hover on subplots when hoversubplots is set to *axis* and x hovermodes
2530
2543
Lib . clearThrottle ( ) ;
2531
2544
Plotly . Fx . hover ( gd , { xval : pos } , subplot ) ;
2532
2545
expect ( gd . _hoverdata . length ) . toBe ( 3 ) ;
2546
+
2547
+ assertFirstPointOn ( gd , 'x' , 'y' ) ;
2533
2548
} ) ;
2534
2549
} ) ;
2535
2550
@@ -2582,6 +2597,9 @@ describe('hover on subplots when hoversubplots is set to *axis* and y hovermodes
2582
2597
Lib . clearThrottle ( ) ;
2583
2598
Plotly . Fx . hover ( gd , { yval : pos } , subplot ) ;
2584
2599
expect ( gd . _hoverdata . length ) . toBe ( 3 ) ;
2600
+
2601
+ assertFirstPointOn ( gd , 'x' , 'y' ) ;
2602
+
2585
2603
assertHoverLabelContent ( {
2586
2604
nums : [ '1' , '10' , '100' ] ,
2587
2605
name : [ 'trace 0' , 'trace 1' , 'trace 2' ] ,
@@ -2594,6 +2612,9 @@ describe('hover on subplots when hoversubplots is set to *axis* and y hovermodes
2594
2612
Plotly . Fx . hover ( gd , { yval : pos } , subplot ) ;
2595
2613
2596
2614
expect ( gd . _hoverdata . length ) . toBe ( 3 ) ;
2615
+
2616
+ assertFirstPointOn ( gd , 'x2' , 'y' ) ;
2617
+
2597
2618
assertHoverLabelContent ( {
2598
2619
nums : [ '2' , '20' , '200' ] ,
2599
2620
name : [ 'trace 0' , 'trace 1' , 'trace 2' ] ,
@@ -2606,6 +2627,9 @@ describe('hover on subplots when hoversubplots is set to *axis* and y hovermodes
2606
2627
Plotly . Fx . hover ( gd , { yval : pos } , subplot ) ;
2607
2628
2608
2629
expect ( gd . _hoverdata . length ) . toBe ( 3 ) ;
2630
+
2631
+ assertFirstPointOn ( gd , 'x3' , 'y' ) ;
2632
+
2609
2633
assertHoverLabelContent ( {
2610
2634
nums : [ '3' , '30' , '300' ] ,
2611
2635
name : [ 'trace 0' , 'trace 1' , 'trace 2' ] ,
@@ -2618,6 +2642,8 @@ describe('hover on subplots when hoversubplots is set to *axis* and y hovermodes
2618
2642
Lib . clearThrottle ( ) ;
2619
2643
Plotly . Fx . hover ( gd , { yval : pos } , subplot ) ;
2620
2644
expect ( gd . _hoverdata . length ) . toBe ( 3 ) ;
2645
+
2646
+ assertFirstPointOn ( gd , 'x' , 'y' ) ;
2621
2647
} ) ;
2622
2648
} ) ;
2623
2649
@@ -2641,6 +2667,9 @@ describe('splom hover on subplots when hoversubplots is set to *axis* and (x|y)
2641
2667
Lib . clearThrottle ( ) ;
2642
2668
Plotly . Fx . hover ( gd , { x : 200 , y : 200 } , 'xy' ) ;
2643
2669
expect ( gd . _hoverdata . length ) . toBe ( 3 ) ;
2670
+
2671
+ assertFirstPointOn ( gd , 'x' , 'y' ) ;
2672
+
2644
2673
assertHoverLabelContent ( {
2645
2674
nums : [ '100' , '100k' ] ,
2646
2675
name : [ '' , '' ] ,
@@ -2651,11 +2680,17 @@ describe('splom hover on subplots when hoversubplots is set to *axis* and (x|y)
2651
2680
2652
2681
Lib . clearThrottle ( ) ;
2653
2682
Plotly . Fx . hover ( gd , { x : 200 , y : 200 } , 'xy' ) ;
2683
+
2684
+ assertFirstPointOn ( gd , 'x' , 'y' ) ;
2685
+
2654
2686
expect ( gd . _hoverdata . length ) . toBe ( 3 ) ;
2655
2687
2656
2688
Plotly . relayout ( gd , 'hovermode' , 'y unified' ) ;
2657
2689
Lib . clearThrottle ( ) ;
2658
2690
Plotly . Fx . hover ( gd , { x : 200 , y : 200 } , 'xy' ) ;
2691
+
2692
+ assertFirstPointOn ( gd , 'x' , 'y' ) ;
2693
+
2659
2694
expect ( gd . _hoverdata . length ) . toBe ( 3 ) ;
2660
2695
} ) ;
2661
2696
} ) ;
@@ -2697,6 +2732,9 @@ describe('splom hover *axis* hoversubplots splom points on same position should
2697
2732
Lib . clearThrottle ( ) ;
2698
2733
Plotly . Fx . hover ( gd , { } , 'xy' ) ;
2699
2734
expect ( gd . _hoverdata . length ) . toBe ( 5 ) ;
2735
+
2736
+ assertFirstPointOn ( gd , 'x' , 'y' ) ;
2737
+
2700
2738
assertHoverLabelContent ( {
2701
2739
nums : [ '1' , '1' , '1' , '1' ] ,
2702
2740
name : [ '' , '' , '' , '' ] ,
@@ -2706,6 +2744,9 @@ describe('splom hover *axis* hoversubplots splom points on same position should
2706
2744
Lib . clearThrottle ( ) ;
2707
2745
Plotly . Fx . hover ( gd , { } , 'xy2' ) ;
2708
2746
expect ( gd . _hoverdata . length ) . toBe ( 4 ) ;
2747
+
2748
+ assertFirstPointOn ( gd , 'x' , 'y2' ) ;
2749
+
2709
2750
assertHoverLabelContent ( {
2710
2751
nums : [ '1' , '2' , '2' ] ,
2711
2752
name : [ '' , '' , '' ] ,
@@ -2715,6 +2756,9 @@ describe('splom hover *axis* hoversubplots splom points on same position should
2715
2756
Lib . clearThrottle ( ) ;
2716
2757
Plotly . Fx . hover ( gd , { } , 'xy3' ) ;
2717
2758
expect ( gd . _hoverdata . length ) . toBe ( 4 ) ;
2759
+
2760
+ assertFirstPointOn ( gd , 'x' , 'y3' ) ;
2761
+
2718
2762
assertHoverLabelContent ( {
2719
2763
nums : [ '1' , '2' , '2' ] ,
2720
2764
name : [ '' , '' , '' ] ,
@@ -2724,6 +2768,9 @@ describe('splom hover *axis* hoversubplots splom points on same position should
2724
2768
Lib . clearThrottle ( ) ;
2725
2769
Plotly . Fx . hover ( gd , { } , 'xy4' ) ;
2726
2770
expect ( gd . _hoverdata . length ) . toBe ( 5 ) ;
2771
+
2772
+ assertFirstPointOn ( gd , 'x' , 'y4' ) ;
2773
+
2727
2774
assertHoverLabelContent ( {
2728
2775
nums : [ '1' , '3' , '3' , '3' ] ,
2729
2776
name : [ '' , '' , '' , '' ] ,
@@ -2733,6 +2780,9 @@ describe('splom hover *axis* hoversubplots splom points on same position should
2733
2780
Lib . clearThrottle ( ) ;
2734
2781
Plotly . Fx . hover ( gd , { } , 'x2y' ) ;
2735
2782
expect ( gd . _hoverdata . length ) . toBe ( 5 ) ;
2783
+
2784
+ assertFirstPointOn ( gd , 'x2' , 'y' ) ;
2785
+
2736
2786
assertHoverLabelContent ( {
2737
2787
nums : [ '1' , '3' , '3' , '3' ] ,
2738
2788
name : [ '' , '' , '' , '' ] ,
@@ -2742,6 +2792,9 @@ describe('splom hover *axis* hoversubplots splom points on same position should
2742
2792
Lib . clearThrottle ( ) ;
2743
2793
Plotly . Fx . hover ( gd , { } , 'x3y' ) ;
2744
2794
expect ( gd . _hoverdata . length ) . toBe ( 5 ) ;
2795
+
2796
+ assertFirstPointOn ( gd , 'x3' , 'y' ) ;
2797
+
2745
2798
assertHoverLabelContent ( {
2746
2799
nums : [ '1' , '3' , '3' , '3' ] ,
2747
2800
name : [ '' , '' , '' , '' ] ,
@@ -2751,6 +2804,9 @@ describe('splom hover *axis* hoversubplots splom points on same position should
2751
2804
Lib . clearThrottle ( ) ;
2752
2805
Plotly . Fx . hover ( gd , { } , 'x4y' ) ;
2753
2806
expect ( gd . _hoverdata . length ) . toBe ( 5 ) ;
2807
+
2808
+ assertFirstPointOn ( gd , 'x4' , 'y' ) ;
2809
+
2754
2810
assertHoverLabelContent ( {
2755
2811
nums : [ '1' , '3' , '3' , '3' ] ,
2756
2812
name : [ '' , '' , '' , '' ] ,
0 commit comments