File tree Expand file tree Collapse file tree 1 file changed +46
-0
lines changed Expand file tree Collapse file tree 1 file changed +46
-0
lines changed Original file line number Diff line number Diff line change @@ -4780,6 +4780,52 @@ describe('hover distance', function() {
4780
4780
} ) ;
4781
4781
} ) ;
4782
4782
4783
+ describe ( 'hover working with zorder' , function ( ) {
4784
+ 'use strict' ;
4785
+
4786
+ var mock = {
4787
+ data : [ {
4788
+ zorder : 100 ,
4789
+ marker : { size : 50 } ,
4790
+ text : [ 'A' , 'B' ] ,
4791
+ y : [ 0 , 1 ]
4792
+ } , {
4793
+ marker : { size : 50 } ,
4794
+ text : [ 'C' , 'D' ] ,
4795
+ y : [ 2 , 1 ]
4796
+ } ] ,
4797
+ layout : {
4798
+ width : 400 ,
4799
+ height : 400 ,
4800
+ showlegend : false ,
4801
+ hovermode : 'closest'
4802
+ }
4803
+ } ;
4804
+
4805
+ afterEach ( destroyGraphDiv ) ;
4806
+
4807
+ beforeEach ( function ( done ) {
4808
+ Plotly . newPlot ( createGraphDiv ( ) , mock ) . then ( done ) ;
4809
+ } ) ;
4810
+
4811
+ it ( 'pick the trace on top' , function ( ) {
4812
+ var gd = document . getElementById ( 'graph' ) ;
4813
+ Fx . hover ( 'graph' , { xval : 1 } , 'xy' ) ;
4814
+
4815
+ expect ( gd . _hoverdata . length ) . toEqual ( 1 ) ;
4816
+
4817
+ assertHoverLabelContent ( {
4818
+ nums : '(1, 1)\nB' ,
4819
+ name : 'trace 0'
4820
+ } ) ;
4821
+
4822
+ var hoverTrace = gd . _hoverdata [ 0 ] ;
4823
+ expect ( hoverTrace . text ) . toEqual ( 'B' ) ;
4824
+ expect ( hoverTrace . curveNumber ) . toEqual ( 0 ) ;
4825
+ expect ( hoverTrace . pointNumber ) . toEqual ( 1 ) ;
4826
+ } ) ;
4827
+ } ) ;
4828
+
4783
4829
describe ( 'hover label rotation:' , function ( ) {
4784
4830
var gd ;
4785
4831
You can’t perform that action at this time.
0 commit comments