@@ -36,6 +36,41 @@ function touch(path, options) {
3636 return ;
3737}
3838
39+ describe ( 'Fx.hover:' , function ( ) {
40+ var gd ;
41+
42+ beforeEach ( function ( ) { gd = createGraphDiv ( ) ; } ) ;
43+
44+ afterEach ( destroyGraphDiv ) ;
45+
46+ it ( 'should warn when passing subplot ids that are not part of the graph' , function ( done ) {
47+ spyOn ( Lib , 'warn' ) ;
48+
49+ var data = [
50+ { y : [ 1 ] , hoverinfo : 'y' }
51+ ] ;
52+
53+ var layout = {
54+ xaxis : { domain : [ 0 , 0.5 ] } ,
55+ xaxis2 : { anchor : 'y2' , domain : [ 0.5 , 1 ] } ,
56+ yaxis2 : { anchor : 'x2' } ,
57+ width : 400 ,
58+ height : 200 ,
59+ margin : { l : 0 , t : 0 , r : 0 , b : 0 } ,
60+ showlegend : false
61+ } ;
62+
63+ Plotly . plot ( gd , data , layout )
64+ . then ( function ( ) {
65+ Fx . hover ( gd , { xpx : 300 , ypx : 100 } , 'x2y2' ) ;
66+ expect ( gd . _hoverdata ) . toBe ( undefined , 'did not generate hoverdata' ) ;
67+ expect ( Lib . warn ) . toHaveBeenCalledWith ( 'Unrecognized subplot: x2y2' ) ;
68+ } )
69+ . catch ( failTest )
70+ . then ( done ) ;
71+ } ) ;
72+ } ) ;
73+
3974describe ( 'hover info' , function ( ) {
4075 'use strict' ;
4176
@@ -2150,7 +2185,6 @@ describe('hover info on stacked subplots', function() {
21502185 } ) ;
21512186} ) ;
21522187
2153-
21542188describe ( 'hover on many lines+bars' , function ( ) {
21552189 'use strict' ;
21562190
0 commit comments