@@ -428,7 +428,7 @@ describe('finance charts calc', function() {
428428        addJunk ( trace1 ) ; 
429429
430430        var  out  =  _calcRaw ( [ trace0 ,  trace1 ] ) ; 
431-         var  indices  =  [ 0 ,  1 ,  2 ,  3 ,  4 ,  5 ,  6 ,  7 ,  undefined ,   undefined ,   undefined ,   undefined ] ; 
431+         var  indices  =  [ 0 ,  1 ,  2 ,  3 ,  4 ,  5 ,  6 ,  7 ,  8 ,   9 ,   10 ,   11 ] ; 
432432        var  i  =  'increasing' ; 
433433        var  d  =  'decreasing' ; 
434434        var  directions  =  [ i ,  d ,  d ,  i ,  d ,  i ,  d ,  i ,  undefined ,  undefined ,  undefined ,  undefined ] ; 
@@ -646,6 +646,44 @@ describe('finance charts calc', function() {
646646    } ) ; 
647647} ) ; 
648648
649+ describe ( 'finance charts auto-range' ,  function ( )  { 
650+     var  gd ; 
651+ 
652+     beforeEach ( function ( )  {  gd  =  createGraphDiv ( ) ;  } ) ; 
653+ 
654+     afterEach ( destroyGraphDiv ) ; 
655+ 
656+     describe ( 'should give correct results with trailing nulls' ,  function ( )  { 
657+         var  base  =  { 
658+             x : [ 'time1' ,  'time2' ,  'time3' ] , 
659+             high : [ 10 ,  11 ,  null ] , 
660+             close : [ 5 ,  6 ,  null ] , 
661+             low : [ 3 ,  3 ,  null ] , 
662+             open : [ 4 ,  4 ,  null ] 
663+         } ; 
664+ 
665+         it ( '- ohlc case' ,  function ( done )  { 
666+             var  trace  =  Lib . extendDeep ( { } ,  base ,  { type : 'ohlc' } ) ; 
667+ 
668+             Plotly . plot ( gd ,  [ trace ] ) . then ( function ( )  { 
669+                 expect ( gd . _fullLayout . xaxis . range ) . toBeCloseToArray ( [ - 0.5 ,  2.5 ] ,  1 ) ; 
670+             } ) 
671+             . catch ( failTest ) 
672+             . then ( done ) ; 
673+         } ) ; 
674+ 
675+         it ( '- candlestick case' ,  function ( done )  { 
676+             var  trace  =  Lib . extendDeep ( { } ,  base ,  { type : 'candlestick' } ) ; 
677+ 
678+             Plotly . plot ( gd ,  [ trace ] ) . then ( function ( )  { 
679+                 expect ( gd . _fullLayout . xaxis . range ) . toBeCloseToArray ( [ - 0.5 ,  2.5 ] ,  1 ) ; 
680+             } ) 
681+             . catch ( failTest ) 
682+             . then ( done ) ; 
683+         } ) ; 
684+     } ) ; 
685+ } ) ; 
686+ 
649687describe ( 'finance charts updates:' ,  function ( )  { 
650688    'use strict' ; 
651689
0 commit comments