@@ -5,7 +5,7 @@ var Box = require('@src/traces/box');
55
66var createGraphDiv = require ( '../assets/create_graph_div' ) ;
77var destroyGraphDiv = require ( '../assets/destroy_graph_div' ) ;
8- var fail = require ( '../assets/fail_test' ) ;
8+ var failTest = require ( '../assets/fail_test' ) ;
99var mouseEvent = require ( '../assets/mouse_event' ) ;
1010
1111var customAssertions = require ( '../assets/custom_assertions' ) ;
@@ -313,7 +313,38 @@ describe('Test box hover:', function() {
313313 name : ''
314314 } ] . forEach ( function ( specs ) {
315315 it ( 'should generate correct hover labels ' + specs . desc , function ( done ) {
316- run ( specs ) . catch ( fail ) . then ( done ) ;
316+ run ( specs ) . catch ( failTest ) . then ( done ) ;
317317 } ) ;
318318 } ) ;
319319} ) ;
320+
321+ describe ( 'Box edge cases' , function ( ) {
322+ var gd ;
323+
324+ beforeEach ( function ( ) {
325+ gd = createGraphDiv ( ) ;
326+ } ) ;
327+
328+ afterEach ( destroyGraphDiv ) ;
329+
330+ it ( 'does not barf on a single outlier with jitter' , function ( done ) {
331+ var trace = {
332+ boxpoints : 'outliers' ,
333+ jitter : 0.7 ,
334+ type : 'box' ,
335+ y : [ 46.505 , 0.143 , 0.649 , 0.059 , 513 , 90 , 234 ]
336+ } ;
337+
338+ Plotly . newPlot ( gd , [ trace ] )
339+ . then ( function ( ) {
340+ var outliers = [ ] ;
341+ gd . calcdata [ 0 ] [ 0 ] . pts . forEach ( function ( pt ) {
342+ if ( pt . x !== undefined ) outliers . push ( pt ) ;
343+ } ) ;
344+ expect ( outliers . length ) . toBe ( 1 ) ;
345+ expect ( outliers [ 0 ] . x ) . toBe ( 0 ) ;
346+ } )
347+ . catch ( failTest )
348+ . then ( done ) ;
349+ } ) ;
350+ } ) ;
0 commit comments