@@ -9,6 +9,9 @@ var failTest = require('../assets/fail_test');
9
9
var customAssertions = require ( '../assets/custom_assertions' ) ;
10
10
var supplyAllDefaults = require ( '../assets/supply_defaults' ) ;
11
11
12
+ var mouseEvent = require ( '../assets/mouse_event' ) ;
13
+ var assertHoverLabelContent = customAssertions . assertHoverLabelContent ;
14
+
12
15
var assertClip = customAssertions . assertClip ;
13
16
var assertNodeDisplay = customAssertions . assertNodeDisplay ;
14
17
@@ -334,17 +337,24 @@ describe('scatterternary hover', function() {
334
337
335
338
var gd ;
336
339
340
+ function check ( pos , content ) {
341
+ mouseEvent ( 'mousemove' , pos [ 0 ] , pos [ 1 ] ) ;
342
+
343
+ assertHoverLabelContent ( {
344
+ nums : content [ 0 ] ,
345
+ name : content [ 1 ]
346
+ } ) ;
347
+ }
348
+
337
349
beforeAll ( function ( done ) {
338
350
gd = createGraphDiv ( ) ;
339
-
340
351
var data = [ {
341
352
type : 'scatterternary' ,
342
353
a : [ 0.1 , 0.2 , 0.3 ] ,
343
354
b : [ 0.3 , 0.2 , 0.1 ] ,
344
355
c : [ 0.1 , 0.4 , 0.5 ] ,
345
356
text : [ 'A' , 'B' , 'C' ]
346
357
} ] ;
347
-
348
358
Plotly . plot ( gd , data ) . then ( done ) ;
349
359
} ) ;
350
360
@@ -418,6 +428,25 @@ describe('scatterternary hover', function() {
418
428
. then ( done ) ;
419
429
} ) ;
420
430
431
+ it ( 'should always display hoverlabel when hovertemplate is defined' , function ( done ) {
432
+ var fig = Lib . extendDeep ( { } , require ( '@mocks/ternary_simple.json' ) ) ;
433
+
434
+ Plotly . newPlot ( gd , fig )
435
+ . then ( function ( ) {
436
+ return Plotly . restyle ( gd , {
437
+ hovertemplate : '%{a}, %{b}, %{c}' ,
438
+ name : '' ,
439
+ text : null ,
440
+ hovertext : null
441
+ } ) ;
442
+ } )
443
+ . then ( function ( ) {
444
+ check ( [ 380 , 210 ] , [ '0.5, 0.25, 0.25' ] ) ;
445
+ } )
446
+ . catch ( failTest )
447
+ . then ( done ) ;
448
+ } ) ;
449
+
421
450
} ) ;
422
451
423
452
describe ( 'Test scatterternary *cliponaxis*' , function ( ) {
0 commit comments