@@ -9,6 +9,9 @@ var failTest = require('../assets/fail_test');
99var customAssertions = require ( '../assets/custom_assertions' ) ;
1010var supplyAllDefaults = require ( '../assets/supply_defaults' ) ;
1111
12+ var mouseEvent = require ( '../assets/mouse_event' ) ;
13+ var assertHoverLabelContent = customAssertions . assertHoverLabelContent ;
14+
1215var assertClip = customAssertions . assertClip ;
1316var assertNodeDisplay = customAssertions . assertNodeDisplay ;
1417
@@ -334,17 +337,24 @@ describe('scatterternary hover', function() {
334337
335338 var gd ;
336339
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+
337349 beforeAll ( function ( done ) {
338350 gd = createGraphDiv ( ) ;
339-
340351 var data = [ {
341352 type : 'scatterternary' ,
342353 a : [ 0.1 , 0.2 , 0.3 ] ,
343354 b : [ 0.3 , 0.2 , 0.1 ] ,
344355 c : [ 0.1 , 0.4 , 0.5 ] ,
345356 text : [ 'A' , 'B' , 'C' ]
346357 } ] ;
347-
348358 Plotly . plot ( gd , data ) . then ( done ) ;
349359 } ) ;
350360
@@ -418,6 +428,25 @@ describe('scatterternary hover', function() {
418428 . then ( done ) ;
419429 } ) ;
420430
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+
421450} ) ;
422451
423452describe ( 'Test scatterternary *cliponaxis*' , function ( ) {
0 commit comments