@@ -1379,13 +1379,72 @@ describe('waterfall hover', function() {
1379
1379
. then ( done ) ;
1380
1380
} ) ;
1381
1381
1382
+ it ( 'should turn off hoverinfo flags with hoveinfo none or skip' , function ( done ) {
1383
+ gd = createGraphDiv ( ) ;
1384
+
1385
+ var mock = Lib . extendDeep ( { } , require ( '@mocks/text_chart_arrays' ) ) ;
1386
+ mock . data . forEach ( function ( t , i ) {
1387
+ t . type = 'waterfall' ;
1388
+ if ( i === 0 ) {
1389
+ t . hoverinfo = 'none' ;
1390
+ } else {
1391
+ t . hoverinfo = 'skip' ;
1392
+ }
1393
+ } ) ;
1394
+
1395
+ function _hover ( ) {
1396
+ var evt = { xpx : 125 , ypx : 150 } ;
1397
+ Fx . hover ( 'graph' , evt , 'xy' ) ;
1398
+ }
1399
+
1400
+ Plotly . plot ( gd , mock )
1401
+ . then ( _hover )
1402
+ . then ( function ( ) {
1403
+ expect ( d3 . selectAll ( 'g.hovertext' ) . size ( ) ) . toBe ( 0 ) ;
1404
+ } )
1405
+ . catch ( failTest )
1406
+ . then ( done ) ;
1407
+ } ) ;
1408
+
1409
+ it ( 'should turn on hoverinfo flags with hoveinfo all' , function ( done ) {
1410
+ gd = createGraphDiv ( ) ;
1411
+
1412
+ var mock = Lib . extendDeep ( { } , require ( '@mocks/text_chart_arrays' ) ) ;
1413
+ mock . data . forEach ( function ( t ) {
1414
+ t . type = 'waterfall' ;
1415
+ t . base = 1000 ;
1416
+ t . hoverinfo = 'all' ;
1417
+ } ) ;
1418
+
1419
+ function _hover ( ) {
1420
+ var evt = { xpx : 125 , ypx : 150 } ;
1421
+ Fx . hover ( 'graph' , evt , 'xy' ) ;
1422
+ }
1423
+
1424
+ Plotly . plot ( gd , mock )
1425
+ . then ( _hover )
1426
+ . then ( function ( ) {
1427
+ assertHoverLabelContent ( {
1428
+ nums : [
1429
+ '1001\nHover text A\n1 ▲\nInitial: 1000' ,
1430
+ '1002\nHover text G\n2 ▲\nInitial: 1000' ,
1431
+ '1,001.5\na (hover)\n1.5 ▲\nInitial: 1000'
1432
+ ] ,
1433
+ name : [ 'Lines, Marke...' , 'Lines and Text' , 'missing text' ] ,
1434
+ axis : '0'
1435
+ } ) ;
1436
+ } )
1437
+ . catch ( failTest )
1438
+ . then ( done ) ;
1439
+ } ) ;
1440
+
1382
1441
it ( 'should use hovertemplate if specified' , function ( done ) {
1383
1442
gd = createGraphDiv ( ) ;
1384
1443
1385
1444
var mock = Lib . extendDeep ( { } , require ( '@mocks/text_chart_arrays' ) ) ;
1386
1445
mock . data . forEach ( function ( t ) {
1387
1446
t . type = 'waterfall' ;
1388
- t . hovertemplate = '%{y}<extra></extra>' ;
1447
+ t . hovertemplate = 'Value: %{y}<br>SUM: %{final}<br>START: %{initial}<br>DIFF: %{delta }<extra></extra>' ;
1389
1448
} ) ;
1390
1449
1391
1450
function _hover ( ) {
@@ -1397,11 +1456,14 @@ describe('waterfall hover', function() {
1397
1456
. then ( _hover )
1398
1457
. then ( function ( ) {
1399
1458
assertHoverLabelContent ( {
1400
- nums : [ '1' , '2' , '1.5' ] ,
1459
+ nums : [
1460
+ 'Value: 1\nSUM: 1\nSTART: 0\nDIFF: 1' ,
1461
+ 'Value: 2\nSUM: 2\nSTART: 0\nDIFF: 2' ,
1462
+ 'Value: 1.5\nSUM: 1.5\nSTART: 0\nDIFF: 1.5'
1463
+ ] ,
1401
1464
name : [ '' , '' , '' ] ,
1402
1465
axis : '0'
1403
1466
} ) ;
1404
- // return Plotly.restyle(gd, 'text', ['APPLE', 'BANANA', 'ORANGE']);
1405
1467
} )
1406
1468
. catch ( failTest )
1407
1469
. then ( done ) ;
0 commit comments