@@ -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
@@ -2640,6 +2666,7 @@ describe('splom hover on subplots when hoversubplots is set to *axis* and (x|y)
2640
2666
it ( 'splom hoversubplots: *axis*' , function ( ) {
2641
2667
Lib . clearThrottle ( ) ;
2642
2668
Plotly . Fx . hover ( gd , { x : 200 , y : 200 } , 'xy' ) ;
2669
+ assertFirstPointOn ( gd , 'x' , 'y' ) ;
2643
2670
expect ( gd . _hoverdata . length ) . toBe ( 2 ) ;
2644
2671
assertHoverLabelContent ( {
2645
2672
nums : [ '100' , '100k' ] ,
@@ -2648,14 +2675,15 @@ describe('splom hover on subplots when hoversubplots is set to *axis* and (x|y)
2648
2675
} ) ;
2649
2676
2650
2677
Plotly . relayout ( gd , 'hovermode' , 'x unified' ) ;
2651
-
2652
2678
Lib . clearThrottle ( ) ;
2653
2679
Plotly . Fx . hover ( gd , { x : 200 , y : 200 } , 'xy' ) ;
2680
+ assertFirstPointOn ( gd , 'x' , 'y' ) ;
2654
2681
expect ( gd . _hoverdata . length ) . toBe ( 2 ) ;
2655
2682
2656
2683
Plotly . relayout ( gd , 'hovermode' , 'y unified' ) ;
2657
2684
Lib . clearThrottle ( ) ;
2658
2685
Plotly . Fx . hover ( gd , { x : 200 , y : 200 } , 'xy' ) ;
2686
+ assertFirstPointOn ( gd , 'x' , 'y' ) ;
2659
2687
expect ( gd . _hoverdata . length ) . toBe ( 2 ) ;
2660
2688
} ) ;
2661
2689
} ) ;
@@ -2696,6 +2724,7 @@ describe('splom hover *axis* hoversubplots splom points on same position should
2696
2724
it ( 'splom *axis* hoversubplots' , function ( ) {
2697
2725
Lib . clearThrottle ( ) ;
2698
2726
Plotly . Fx . hover ( gd , { } , 'xy' ) ;
2727
+ assertFirstPointOn ( gd , 'x' , 'y' ) ;
2699
2728
expect ( gd . _hoverdata . length ) . toBe ( 4 ) ;
2700
2729
assertHoverLabelContent ( {
2701
2730
nums : [ '1' , '1' , '1' , '1' ] ,
@@ -2705,6 +2734,7 @@ describe('splom hover *axis* hoversubplots splom points on same position should
2705
2734
2706
2735
Lib . clearThrottle ( ) ;
2707
2736
Plotly . Fx . hover ( gd , { } , 'xy2' ) ;
2737
+ assertFirstPointOn ( gd , 'x' , 'y2' ) ;
2708
2738
expect ( gd . _hoverdata . length ) . toBe ( 3 ) ;
2709
2739
assertHoverLabelContent ( {
2710
2740
nums : [ '1' , '2' , '2' ] ,
@@ -2714,6 +2744,7 @@ describe('splom hover *axis* hoversubplots splom points on same position should
2714
2744
2715
2745
Lib . clearThrottle ( ) ;
2716
2746
Plotly . Fx . hover ( gd , { } , 'xy3' ) ;
2747
+ assertFirstPointOn ( gd , 'x' , 'y3' ) ;
2717
2748
expect ( gd . _hoverdata . length ) . toBe ( 3 ) ;
2718
2749
assertHoverLabelContent ( {
2719
2750
nums : [ '1' , '2' , '2' ] ,
@@ -2723,6 +2754,7 @@ describe('splom hover *axis* hoversubplots splom points on same position should
2723
2754
2724
2755
Lib . clearThrottle ( ) ;
2725
2756
Plotly . Fx . hover ( gd , { } , 'xy4' ) ;
2757
+ assertFirstPointOn ( gd , 'x' , 'y4' ) ;
2726
2758
expect ( gd . _hoverdata . length ) . toBe ( 4 ) ;
2727
2759
assertHoverLabelContent ( {
2728
2760
nums : [ '1' , '3' , '3' , '3' ] ,
@@ -2732,6 +2764,7 @@ describe('splom hover *axis* hoversubplots splom points on same position should
2732
2764
2733
2765
Lib . clearThrottle ( ) ;
2734
2766
Plotly . Fx . hover ( gd , { } , 'x2y' ) ;
2767
+ assertFirstPointOn ( gd , 'x2' , 'y' ) ;
2735
2768
expect ( gd . _hoverdata . length ) . toBe ( 4 ) ;
2736
2769
assertHoverLabelContent ( {
2737
2770
nums : [ '1' , '3' , '3' , '3' ] ,
@@ -2741,6 +2774,7 @@ describe('splom hover *axis* hoversubplots splom points on same position should
2741
2774
2742
2775
Lib . clearThrottle ( ) ;
2743
2776
Plotly . Fx . hover ( gd , { } , 'x3y' ) ;
2777
+ assertFirstPointOn ( gd , 'x3' , 'y' ) ;
2744
2778
expect ( gd . _hoverdata . length ) . toBe ( 4 ) ;
2745
2779
assertHoverLabelContent ( {
2746
2780
nums : [ '1' , '3' , '3' , '3' ] ,
@@ -2750,6 +2784,7 @@ describe('splom hover *axis* hoversubplots splom points on same position should
2750
2784
2751
2785
Lib . clearThrottle ( ) ;
2752
2786
Plotly . Fx . hover ( gd , { } , 'x4y' ) ;
2787
+ assertFirstPointOn ( gd , 'x4' , 'y' ) ;
2753
2788
expect ( gd . _hoverdata . length ) . toBe ( 4 ) ;
2754
2789
assertHoverLabelContent ( {
2755
2790
nums : [ '1' , '3' , '3' , '3' ] ,
0 commit comments