@@ -1379,13 +1379,72 @@ describe('waterfall hover', function() {
13791379 . then ( done ) ;
13801380 } ) ;
13811381
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+
13821441 it ( 'should use hovertemplate if specified' , function ( done ) {
13831442 gd = createGraphDiv ( ) ;
13841443
13851444 var mock = Lib . extendDeep ( { } , require ( '@mocks/text_chart_arrays' ) ) ;
13861445 mock . data . forEach ( function ( t ) {
13871446 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>' ;
13891448 } ) ;
13901449
13911450 function _hover ( ) {
@@ -1397,11 +1456,14 @@ describe('waterfall hover', function() {
13971456 . then ( _hover )
13981457 . then ( function ( ) {
13991458 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+ ] ,
14011464 name : [ '' , '' , '' ] ,
14021465 axis : '0'
14031466 } ) ;
1404- // return Plotly.restyle(gd, 'text', ['APPLE', 'BANANA', 'ORANGE']);
14051467 } )
14061468 . catch ( failTest )
14071469 . then ( done ) ;
0 commit comments