File tree Expand file tree Collapse file tree 1 file changed +65
-0
lines changed Expand file tree Collapse file tree 1 file changed +65
-0
lines changed Original file line number Diff line number Diff line change @@ -2380,6 +2380,71 @@ describe('hover info on stacked subplots', function() {
23802380 } ) ;
23812381} ) ;
23822382
2383+ describe ( 'hover on subplots when hoversubplots is set to *single* and x hovermodes' , function ( ) {
2384+ 'use strict' ;
2385+
2386+ var mock = {
2387+ layout : {
2388+ hoversubplots : 'single' ,
2389+ hovermode : 'x' ,
2390+ yaxis2 : {
2391+ anchor : 'x' ,
2392+ overlaying : 'y'
2393+ }
2394+ } ,
2395+
2396+ data : [
2397+ {
2398+ y : [ 1 , 2 , 3 ]
2399+ } ,
2400+ {
2401+ y : [ 1 , 3 , 2 ] ,
2402+ yaxis : 'y2'
2403+ }
2404+ ] ,
2405+ } ;
2406+
2407+ var gd ;
2408+
2409+ beforeEach ( function ( done ) {
2410+ gd = createGraphDiv ( ) ;
2411+ Plotly . newPlot ( gd , mock ) . then ( done ) ;
2412+ } ) ;
2413+
2414+ afterEach ( destroyGraphDiv ) ;
2415+
2416+ it ( 'hovermode: *x* | *x unified* with hoversubplots: *axis*' , function ( ) {
2417+ var pos = 0 ;
2418+ var subplot = 'xy' ;
2419+ Lib . clearThrottle ( ) ;
2420+ Plotly . Fx . hover ( gd , { xval : pos } , subplot ) ;
2421+ expect ( gd . _hoverdata . length ) . toBe ( 1 ) ;
2422+ assertHoverLabelContent ( {
2423+ nums : '1' ,
2424+ name : 'trace 0' ,
2425+ axis : String ( pos )
2426+ } ) ;
2427+
2428+ pos = 0 ;
2429+ subplot = 'xy2' ;
2430+ Lib . clearThrottle ( ) ;
2431+ Plotly . Fx . hover ( gd , { xval : pos } , subplot ) ;
2432+ expect ( gd . _hoverdata . length ) . toBe ( 1 ) ;
2433+ assertHoverLabelContent ( {
2434+ nums : '1' ,
2435+ name : 'trace 1' ,
2436+ axis : String ( pos )
2437+ } ) ;
2438+
2439+ Plotly . relayout ( gd , 'hovermode' , 'x unified' ) ;
2440+ pos = 0 ;
2441+ subplot = 'xy' ;
2442+ Lib . clearThrottle ( ) ;
2443+ Plotly . Fx . hover ( gd , { xval : pos } , subplot ) ;
2444+ expect ( gd . _hoverdata . length ) . toBe ( 1 ) ;
2445+ } ) ;
2446+ } ) ;
2447+
23832448describe ( 'hover on subplots when hoversubplots is set to *axis* and x hovermodes' , function ( ) {
23842449 'use strict' ;
23852450
You can’t perform that action at this time.
0 commit comments