@@ -167,6 +167,7 @@ describe('Test choropleth hover:', function() {
167
167
168
168
function run ( hasCssTransform , pos , fig , content , style ) {
169
169
gd = createGraphDiv ( ) ;
170
+ var scale = 1 ;
170
171
171
172
style = style || {
172
173
bgcolor : 'rgb(68, 68, 68)' ,
@@ -176,8 +177,14 @@ describe('Test choropleth hover:', function() {
176
177
fontFamily : 'Arial'
177
178
} ;
178
179
179
- function assertHoverLabel ( posX , posY ) {
180
- mouseEvent ( 'mousemove' , posX , posY ) ;
180
+ return Plotly . newPlot ( gd , fig )
181
+ . then ( function ( ) {
182
+ if ( hasCssTransform ) {
183
+ scale = 0.5 ;
184
+ transformPlot ( gd , 'translate(-25%, -25%) scale(0.5)' ) ;
185
+ }
186
+
187
+ mouseEvent ( 'mousemove' , scale * pos [ 0 ] , scale * pos [ 1 ] ) ;
181
188
assertHoverLabelContent ( {
182
189
nums : content [ 0 ] ,
183
190
name : content [ 1 ]
@@ -186,18 +193,6 @@ describe('Test choropleth hover:', function() {
186
193
d3Select ( 'g.hovertext' ) ,
187
194
style
188
195
) ;
189
- }
190
-
191
- return Plotly . newPlot ( gd , fig )
192
- . then ( function ( ) {
193
- if ( hasCssTransform ) {
194
- transformPlot ( gd , 'translate3d(10px, 10px, 0) scale(1)' ) ;
195
- assertHoverLabel ( pos [ 0 ] + 10 , pos [ 1 ] + 10 ) ;
196
- transformPlot ( gd , 'translate(-25%, -25%) scale(0.5)' ) ;
197
- assertHoverLabel ( 0.5 * pos [ 0 ] , 0.5 * pos [ 1 ] ) ;
198
- } else {
199
- assertHoverLabel ( pos [ 0 ] , pos [ 1 ] ) ;
200
- }
201
196
} ) ;
202
197
}
203
198
0 commit comments