@@ -60,6 +60,39 @@ describe('Test scatter', function() {
6060 expect ( traceOut . visible ) . toBe ( false ) ;
6161 } ) ;
6262
63+ it ( 'should correctly assign \'hoveron\' default' , function ( ) {
64+ traceIn = {
65+ x : [ 1 , 2 , 3 ] ,
66+ y : [ 1 , 2 , 3 ] ,
67+ mode : 'lines+markers' ,
68+ fill : 'tonext'
69+ } ;
70+
71+ // even with fill tonext, as long as there are markers or text
72+ // you get points
73+ // you need visible: true here, as that normally gets set
74+ // outside of the module supplyDefaults
75+ traceOut = { visible : true } ;
76+ supplyDefaults ( traceIn , traceOut , defaultColor , layout ) ;
77+ expect ( traceOut . hoveron ) . toBe ( 'points' ) ;
78+
79+ // but with only lines (or just fill) and fill tonext or toself
80+ // you get fills
81+ traceIn . mode = 'lines' ;
82+ traceOut = { visible : true } ;
83+ supplyDefaults ( traceIn , traceOut , defaultColor , layout ) ;
84+ expect ( traceOut . hoveron ) . toBe ( 'fills' ) ;
85+
86+ // with the wrong fill you always get points
87+ // only area fills default to hoveron points. Vertical or
88+ // horizontal fills don't have the same physical meaning,
89+ // they're generally just filling their own slice, so they
90+ // default to hoveron points.
91+ traceIn . fill = 'tonexty' ;
92+ traceOut = { visible : true } ;
93+ supplyDefaults ( traceIn , traceOut , defaultColor , layout ) ;
94+ expect ( traceOut . hoveron ) . toBe ( 'points' ) ;
95+ } ) ;
6396 } ) ;
6497
6598 describe ( 'isBubble' , function ( ) {
0 commit comments