@@ -23,6 +23,60 @@ function getClientPosition(selector, index) {
23
23
describe ( 'pie hovering' , function ( ) {
24
24
var mock = require ( '@mocks/pie_simple.json' ) ;
25
25
26
+ describe ( 'with hoverinfo set to none' , function ( ) {
27
+ var mockCopy = Lib . extendDeep ( { } , mock ) ,
28
+ gd ;
29
+
30
+ mockCopy . data [ 0 ] . hoverinfo = 'none' ;
31
+
32
+ beforeEach ( function ( done ) {
33
+ gd = createGraphDiv ( ) ;
34
+
35
+ Plotly . plot ( gd , mockCopy . data , mockCopy . layout )
36
+ . then ( done ) ;
37
+ } ) ;
38
+
39
+ afterEach ( destroyGraphDiv ) ;
40
+
41
+ it ( 'should fire hover event when moving from one slice to another' , function ( done ) {
42
+ var count = 0 ,
43
+ hoverData = [ ] ;
44
+
45
+ gd . on ( 'plotly_hover' , function ( data ) {
46
+ count ++ ;
47
+ hoverData . push ( data ) ;
48
+ } ) ;
49
+
50
+ mouseEvent ( 'mouseover' , 173 , 133 ) ;
51
+ setTimeout ( function ( ) {
52
+ mouseEvent ( 'mouseover' , 233 , 193 ) ;
53
+ expect ( count ) . toEqual ( 2 ) ;
54
+ expect ( hoverData [ 0 ] ) . not . toEqual ( hoverData [ 1 ] ) ;
55
+ done ( ) ;
56
+ } , 100 ) ;
57
+ } ) ;
58
+
59
+ it ( 'should fire unhover event when the mouse moves off the graph' , function ( done ) {
60
+ var count = 0 ,
61
+ unhoverData = [ ] ;
62
+
63
+ gd . on ( 'plotly_unhover' , function ( data ) {
64
+ count ++ ;
65
+ unhoverData . push ( data ) ;
66
+ } ) ;
67
+
68
+ mouseEvent ( 'mouseover' , 173 , 133 ) ;
69
+ mouseEvent ( 'mouseout' , 173 , 133 ) ;
70
+ setTimeout ( function ( ) {
71
+ mouseEvent ( 'mouseover' , 233 , 193 ) ;
72
+ mouseEvent ( 'mouseout' , 233 , 193 ) ;
73
+ expect ( count ) . toEqual ( 2 ) ;
74
+ expect ( unhoverData [ 0 ] ) . not . toEqual ( unhoverData [ 1 ] ) ;
75
+ done ( ) ;
76
+ } , 100 ) ;
77
+ } ) ;
78
+ } ) ;
79
+
26
80
describe ( 'event data' , function ( ) {
27
81
var mockCopy = Lib . extendDeep ( { } , mock ) ,
28
82
width = mockCopy . layout . width ,
0 commit comments