@@ -42,9 +42,7 @@ describe('Test gl3d plots', function() {
42
42
mock2 . data [ 0 ] . surfaceaxis = 2 ;
43
43
mock2 . layout . showlegend = true ;
44
44
45
- function mouseEventScatter3d ( type , opts ) {
46
- mouseEvent ( type , 605 , 271 , opts ) ;
47
- }
45
+ var mock3 = require ( '@mocks/gl3d_autocolorscale' ) ;
48
46
49
47
function assertHoverText ( xLabel , yLabel , zLabel , textLabel ) {
50
48
var node = d3 . selectAll ( 'g.hovertext' ) ;
@@ -83,11 +81,11 @@ describe('Test gl3d plots', function() {
83
81
destroyGraphDiv ( ) ;
84
82
} ) ;
85
83
86
- it ( '@noCI should display correct hover labels and emit correct event data' , function ( done ) {
84
+ it ( '@noCI should display correct hover labels and emit correct event data (scatter3d case) ' , function ( done ) {
87
85
var _mock = Lib . extendDeep ( { } , mock2 ) ;
88
86
89
87
function _hover ( ) {
90
- mouseEventScatter3d ( 'mouseover' ) ;
88
+ mouseEvent ( 'mouseover' , 605 , 271 ) ;
91
89
return delay ( ) ;
92
90
}
93
91
@@ -150,16 +148,39 @@ describe('Test gl3d plots', function() {
150
148
assertHoverText ( 'x: 二 6, 2017' , 'y: c' , 'z: 100k' , 'Clementine' ) ;
151
149
} )
152
150
. then ( done ) ;
151
+ } ) ;
152
+
153
+ it ( '@noCI should display correct hover labels and emit correct event data (surface case)' , function ( done ) {
154
+ var _mock = Lib . extendDeep ( { } , mock3 ) ;
155
+
156
+ function _hover ( ) {
157
+ mouseEvent ( 'mouseover' , 605 , 271 ) ;
158
+ return delay ( ) ;
159
+ }
153
160
161
+ Plotly . plot ( gd , _mock )
162
+ . then ( delay )
163
+ . then ( function ( ) {
164
+ gd . on ( 'plotly_hover' , function ( eventData ) {
165
+ ptData = eventData . points [ 0 ] ;
166
+ } ) ;
167
+ } )
168
+ . then ( _hover )
169
+ . then ( delay )
170
+ . then ( function ( ) {
171
+ assertHoverText ( 'x: 1' , 'y: 2' , 'z: 43' , 'one two' ) ;
172
+ assertEventData ( 1 , 2 , 43 , 0 , [ 1 , 2 ] ) ;
173
+ } )
174
+ . then ( done ) ;
154
175
} ) ;
155
176
156
- it ( '@noCI should emit correct event data on click' , function ( done ) {
177
+ it ( '@noCI should emit correct event data on click (scatter3d case) ' , function ( done ) {
157
178
var _mock = Lib . extendDeep ( { } , mock2 ) ;
158
179
159
180
// N.B. gl3d click events are 'mouseover' events
160
181
// with button 1 pressed
161
182
function _click ( ) {
162
- mouseEventScatter3d ( 'mouseover' , { buttons : 1 } ) ;
183
+ mouseEvent ( 'mouseover' , 605 , 271 , { buttons : 1 } ) ;
163
184
return delay ( ) ;
164
185
}
165
186
0 commit comments