@@ -4,6 +4,7 @@ var Plotly = require('@lib/index');
44var Fx = require ( '@src/components/fx' ) ;
55var Lib = require ( '@src/lib' ) ;
66
7+ var fail = require ( '../assets/fail_test' ) ;
78var createGraphDiv = require ( '../assets/create_graph_div' ) ;
89var destroyGraphDiv = require ( '../assets/destroy_graph_div' ) ;
910
@@ -16,6 +17,7 @@ describe('spikeline', function() {
1617
1718 describe ( 'hover' , function ( ) {
1819 var mockCopy = Lib . extendDeep ( { } , mock ) ;
20+ var gd ;
1921
2022 mockCopy . layout . xaxis . showspikes = true ;
2123 mockCopy . layout . xaxis . spikemode = 'toaxis' ;
@@ -24,8 +26,10 @@ describe('spikeline', function() {
2426 mockCopy . layout . xaxis2 . showspikes = true ;
2527 mockCopy . layout . xaxis2 . spikemode = 'toaxis' ;
2628 mockCopy . layout . hovermode = 'closest' ;
29+
2730 beforeEach ( function ( done ) {
28- Plotly . plot ( createGraphDiv ( ) , mockCopy . data , mockCopy . layout ) . then ( done ) ;
31+ gd = createGraphDiv ( ) ;
32+ Plotly . plot ( gd , mockCopy . data , mockCopy . layout ) . then ( done ) ;
2933 } ) ;
3034
3135 it ( 'draws lines and markers on enabled axes' , function ( ) {
@@ -34,6 +38,20 @@ describe('spikeline', function() {
3438 expect ( d3 . selectAll ( 'circle.spikeline' ) . size ( ) ) . toEqual ( 1 ) ;
3539 } ) ;
3640
41+ it ( 'draws lines and markers on enabled axes w/o tick labels' , function ( done ) {
42+ Plotly . relayout ( gd , {
43+ 'xaxis.showticklabels' : false ,
44+ 'yaxis.showticklabels' : false
45+ } )
46+ . then ( function ( ) {
47+ Fx . hover ( 'graph' , { xval : 2 , yval : 3 } , 'xy' ) ;
48+ expect ( d3 . selectAll ( 'line.spikeline' ) . size ( ) ) . toEqual ( 4 ) ;
49+ expect ( d3 . selectAll ( 'circle.spikeline' ) . size ( ) ) . toEqual ( 1 ) ;
50+ } )
51+ . catch ( fail )
52+ . then ( done ) ;
53+ } ) ;
54+
3755 it ( 'doesn\'t draw lines and markers on disabled axes' , function ( ) {
3856 Fx . hover ( 'graph' , { xval : 30 , yval : 40 } , 'x2y2' ) ;
3957 expect ( d3 . selectAll ( 'line.spikeline' ) . size ( ) ) . toEqual ( 2 ) ;
0 commit comments