@@ -4,6 +4,7 @@ var Plotly = require('@lib/index');
4
4
var Fx = require ( '@src/components/fx' ) ;
5
5
var Lib = require ( '@src/lib' ) ;
6
6
7
+ var fail = require ( '../assets/fail_test' ) ;
7
8
var createGraphDiv = require ( '../assets/create_graph_div' ) ;
8
9
var destroyGraphDiv = require ( '../assets/destroy_graph_div' ) ;
9
10
@@ -16,6 +17,7 @@ describe('spikeline', function() {
16
17
17
18
describe ( 'hover' , function ( ) {
18
19
var mockCopy = Lib . extendDeep ( { } , mock ) ;
20
+ var gd ;
19
21
20
22
mockCopy . layout . xaxis . showspikes = true ;
21
23
mockCopy . layout . xaxis . spikemode = 'toaxis' ;
@@ -24,8 +26,10 @@ describe('spikeline', function() {
24
26
mockCopy . layout . xaxis2 . showspikes = true ;
25
27
mockCopy . layout . xaxis2 . spikemode = 'toaxis' ;
26
28
mockCopy . layout . hovermode = 'closest' ;
29
+
27
30
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 ) ;
29
33
} ) ;
30
34
31
35
it ( 'draws lines and markers on enabled axes' , function ( ) {
@@ -34,6 +38,20 @@ describe('spikeline', function() {
34
38
expect ( d3 . selectAll ( 'circle.spikeline' ) . size ( ) ) . toEqual ( 1 ) ;
35
39
} ) ;
36
40
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
+
37
55
it ( 'doesn\'t draw lines and markers on disabled axes' , function ( ) {
38
56
Fx . hover ( 'graph' , { xval : 30 , yval : 40 } , 'x2y2' ) ;
39
57
expect ( d3 . selectAll ( 'line.spikeline' ) . size ( ) ) . toEqual ( 2 ) ;
0 commit comments