@@ -574,3 +574,34 @@ describe('hover info on stacked subplots', function() {
574
574
} ) ;
575
575
} ) ;
576
576
} ) ;
577
+
578
+
579
+ describe ( 'hover info on overlaid subplots' , function ( ) {
580
+ 'use strict' ;
581
+
582
+ afterEach ( destroyGraphDiv ) ;
583
+
584
+ it ( 'should respond to hover' , function ( done ) {
585
+ var mock = require ( '@mocks/autorange-tozero-rangemode.json' ) ;
586
+
587
+ Plotly . plot ( createGraphDiv ( ) , mock . data , mock . layout ) . then ( function ( ) {
588
+ mouseEvent ( 'mousemove' , 775 , 352 ) ;
589
+
590
+ var axisText = d3 . selectAll ( 'g.axistext' ) ,
591
+ hoverText = d3 . selectAll ( 'g.hovertext' ) ;
592
+
593
+ expect ( axisText . size ( ) ) . toEqual ( 1 , 'with 1 label on axis' ) ;
594
+ expect ( hoverText . size ( ) ) . toEqual ( 2 , 'with 2 labels on the overlaid pts' ) ;
595
+
596
+ expect ( axisText . select ( 'text' ) . html ( ) ) . toEqual ( '1' , 'with correct axis label' ) ;
597
+
598
+ var textNodes = hoverText . selectAll ( 'text' ) ;
599
+
600
+ expect ( textNodes [ 0 ] [ 0 ] . innerHTML ) . toEqual ( 'Take Rate' , 'with correct hover labels' ) ;
601
+ expect ( textNodes [ 0 ] [ 1 ] . innerHTML ) . toEqual ( '0.35' , 'with correct hover labels' ) ;
602
+ expect ( textNodes [ 1 ] [ 0 ] . innerHTML ) . toEqual ( 'Revenue' , 'with correct hover labels' ) ;
603
+ expect ( textNodes [ 1 ] [ 1 ] . innerHTML ) . toEqual ( '2,352.5' , 'with correct hover labels' ) ;
604
+
605
+ } ) . then ( done ) ;
606
+ } ) ;
607
+ } ) ;
0 commit comments