@@ -152,6 +152,40 @@ describe('Test boxes supplyDefaults', function() {
152152 expect ( traceOut . text ) . toBeDefined ( ) ;
153153 } ) ;
154154
155+ describe ( 'should not coerce hovertemplate when *hoveron* does not contains *points* flag' , function ( ) {
156+ var ht = '--- %{y}' ;
157+
158+ it ( '- case hoveron:points' , function ( ) {
159+ traceIn = {
160+ y : [ 1 , 1 , 2 ] ,
161+ hoveron : 'points' ,
162+ hovertemplate : ht
163+ } ;
164+ supplyDefaults ( traceIn , traceOut , defaultColor , { } ) ;
165+ expect ( traceOut . hovertemplate ) . toBe ( ht ) ;
166+ } ) ;
167+
168+ it ( '- case hoveron:points+boxes' , function ( ) {
169+ traceIn = {
170+ y : [ 1 , 1 , 2 ] ,
171+ hoveron : 'points+boxes' ,
172+ hovertemplate : ht
173+ } ;
174+ supplyDefaults ( traceIn , traceOut , defaultColor , { } ) ;
175+ expect ( traceOut . hovertemplate ) . toBe ( ht ) ;
176+ } ) ;
177+
178+ it ( '- case hoveron:boxes' , function ( ) {
179+ traceIn = {
180+ y : [ 1 , 1 , 2 ] ,
181+ hoveron : 'boxes' ,
182+ hovertemplate : ht
183+ } ;
184+ supplyDefaults ( traceIn , traceOut , defaultColor , { } ) ;
185+ expect ( traceOut . hovertemplate ) . toBe ( undefined ) ;
186+ } ) ;
187+ } ) ;
188+
155189 it ( 'should not include alignementgroup/offsetgroup when boxmode is not *group*' , function ( ) {
156190 var gd = {
157191 data : [ { type : 'box' , y : [ 1 ] , alignmentgroup : 'a' , offsetgroup : '1' } ] ,
@@ -391,6 +425,19 @@ describe('Test box hover:', function() {
391425 pos : [ 202 , 335 ] ,
392426 nums : '(2, 13.1)' ,
393427 name : ''
428+ } , {
429+ desc : 'with hovertemplate for points' ,
430+ patch : function ( fig ) {
431+ fig . data . forEach ( function ( trace ) {
432+ trace . boxpoints = 'all' ;
433+ trace . hoveron = 'points' ;
434+ trace . hovertemplate = '%{y}<extra>pt #%{pointNumber}</extra>' ;
435+ } ) ;
436+ fig . layout . hovermode = 'closest' ;
437+ return fig ;
438+ } ,
439+ nums : '0.6' ,
440+ name : 'pt #0'
394441 } ] . forEach ( function ( specs ) {
395442 it ( 'should generate correct hover labels ' + specs . desc , function ( done ) {
396443 run ( specs ) . catch ( failTest ) . then ( done ) ;
0 commit comments