@@ -96,6 +96,70 @@ describe('Test click interactions:', function() {
96
96
} ) ;
97
97
} ) ;
98
98
99
+ describe ( 'click events with hoverinfo set to none' , function ( ) {
100
+ var futureData ;
101
+
102
+ beforeEach ( function ( done ) {
103
+ gd = createGraphDiv ( ) ;
104
+
105
+ var mockCopy = Lib . extendDeep ( { } , mock ) ;
106
+ mockCopy . data [ 0 ] . hoverinfo = 'none' ;
107
+ Plotly . plot ( gd , mockCopy . data , mockCopy . layout )
108
+ . then ( done ) ;
109
+
110
+ gd . on ( 'plotly_click' , function ( data ) {
111
+ futureData = data ;
112
+ } ) ;
113
+ } ) ;
114
+
115
+ it ( 'should contain the correct fields despite hoverinfo: "none"' , function ( ) {
116
+ click ( pointPos [ 0 ] , pointPos [ 1 ] ) ;
117
+ expect ( futureData . points . length ) . toEqual ( 1 ) ;
118
+
119
+ var pt = futureData . points [ 0 ] ;
120
+ expect ( Object . keys ( pt ) ) . toEqual ( [
121
+ 'data' , 'fullData' , 'curveNumber' , 'pointNumber' ,
122
+ 'x' , 'y' , 'xaxis' , 'yaxis'
123
+ ] ) ;
124
+ expect ( pt . curveNumber ) . toEqual ( 0 ) ;
125
+ expect ( pt . pointNumber ) . toEqual ( 11 ) ;
126
+ expect ( pt . x ) . toEqual ( 0.125 ) ;
127
+ expect ( pt . y ) . toEqual ( 2.125 ) ;
128
+ } ) ;
129
+ } ) ;
130
+
131
+ describe ( 'click events with hoverinfo set to none' , function ( ) {
132
+ var futureData ;
133
+
134
+ beforeEach ( function ( done ) {
135
+ gd = createGraphDiv ( ) ;
136
+
137
+ var mockCopy = Lib . extendDeep ( { } , mock ) ;
138
+ mockCopy . data [ 0 ] . hoverinfo = 'none' ;
139
+ Plotly . plot ( gd , mockCopy . data , mockCopy . layout )
140
+ . then ( done ) ;
141
+
142
+ gd . on ( 'plotly_hover' , function ( data ) {
143
+ futureData = data ;
144
+ } ) ;
145
+ } ) ;
146
+
147
+ it ( 'should contain the correct fields despite hoverinfo: "none"' , function ( ) {
148
+ click ( pointPos [ 0 ] , pointPos [ 1 ] ) ;
149
+ expect ( futureData . points . length ) . toEqual ( 1 ) ;
150
+
151
+ var pt = futureData . points [ 0 ] ;
152
+ expect ( Object . keys ( pt ) ) . toEqual ( [
153
+ 'data' , 'fullData' , 'curveNumber' , 'pointNumber' ,
154
+ 'x' , 'y' , 'xaxis' , 'yaxis'
155
+ ] ) ;
156
+ expect ( pt . curveNumber ) . toEqual ( 0 ) ;
157
+ expect ( pt . pointNumber ) . toEqual ( 11 ) ;
158
+ expect ( pt . x ) . toEqual ( 0.125 ) ;
159
+ expect ( pt . y ) . toEqual ( 2.125 ) ;
160
+ } ) ;
161
+ } ) ;
162
+
99
163
describe ( 'double click events' , function ( ) {
100
164
var futureData ;
101
165
0 commit comments