@@ -42,9 +42,7 @@ describe('Test gl3d plots', function() {
4242 mock2 . data [ 0 ] . surfaceaxis = 2 ;
4343 mock2 . layout . showlegend = true ;
4444
45- function mouseEventScatter3d ( type , opts ) {
46- mouseEvent ( type , 605 , 271 , opts ) ;
47- }
45+ var mock3 = require ( '@mocks/gl3d_autocolorscale' ) ;
4846
4947 function assertHoverText ( xLabel , yLabel , zLabel , textLabel ) {
5048 var node = d3 . selectAll ( 'g.hovertext' ) ;
@@ -83,11 +81,11 @@ describe('Test gl3d plots', function() {
8381 destroyGraphDiv ( ) ;
8482 } ) ;
8583
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 ) {
8785 var _mock = Lib . extendDeep ( { } , mock2 ) ;
8886
8987 function _hover ( ) {
90- mouseEventScatter3d ( 'mouseover' ) ;
88+ mouseEvent ( 'mouseover' , 605 , 271 ) ;
9189 return delay ( ) ;
9290 }
9391
@@ -150,16 +148,39 @@ describe('Test gl3d plots', function() {
150148 assertHoverText ( 'x: 二 6, 2017' , 'y: c' , 'z: 100k' , 'Clementine' ) ;
151149 } )
152150 . 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+ }
153160
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 ) ;
154175 } ) ;
155176
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 ) {
157178 var _mock = Lib . extendDeep ( { } , mock2 ) ;
158179
159180 // N.B. gl3d click events are 'mouseover' events
160181 // with button 1 pressed
161182 function _click ( ) {
162- mouseEventScatter3d ( 'mouseover' , { buttons : 1 } ) ;
183+ mouseEvent ( 'mouseover' , 605 , 271 , { buttons : 1 } ) ;
163184 return delay ( ) ;
164185 }
165186
0 commit comments